MySQL ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO
MySQL安装完server端和客户端后,登录Mysql时报错:
[root@rhel204 MySQL 5.6.23-RMP]# mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
[root@rhel204 MySQL 5.6.23-RMP]# service mysql start
Starting MySQL.[ OK ]
[root@rhel204 MySQL 5.6.23-RMP for oraclelinux or rhel5-x86-64V74393-01]# mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO
安装过程中并没有设置过任何密码,重装多次也是如此。。。。。
==========================
处理方法:
Reset Forgotten MySQL Root Password:
First things first. Log in as root and stop the mysql daemon.
sudo /etc/init.d/mysql stop
Now lets start up the mysql daemon and skip the grant tables which store the passwords.
sudo mysqld_safe --skip-grant-tables&
(press Ctrl+C now to disown the process and start typing commands again)
You should see mysqld start up successfully. If not, well you have bigger issues. Now you should be able to connect to mysql without a password.
sudo mysql --user=root mysql
update user set password=password('new-password');
flush privileges;
exit;
Now kill your running mysqld then restart it normally.
sudo killall mysqld_safe&
(press Ctrl+C now to disown the process and start typing commands again)
/etc/init.d/mysql start
You should be good to go. Try not to forget your password again.
https://www.howtoforge.com/reset-forgotten-mysql-root-password
http://www.cnblogs.com/khler/archive/2011/02/10/1950819.html
[root@rhel201 mysql]# mysql -uroot -p --使用上面修改的新密码登录
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is
Server version: 5.6.-enterprise-commercial-advanced Copyright (c) , , Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> show databases;
ERROR 1820 (HY000): You must SET PASSWORD before executing this statement
mysql> exit
Bye
需要重新修改密码:
[root@rhel201 mysql]# mysqladmin -uroot -p password rusky --将密码修改为rusky
Enter password:
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: YES)'
[root@rhel201 mysql]# mysqladmin -uroot -p password rusky
Enter password:
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: YES)'
[root@rhel201 mysql]# mysqladmin -uroot -p password rusky
Enter password:
Warning: Using a password on the command line interface can be insecure.
[root@rhel201 mysql]# mysql -uroot -p --使用新密码登录正常。
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is
Server version: 5.6.-enterprise-commercial-advanced MySQL Enterprise Server - Advanced Edition (Commercial) Copyright (c) , , Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>
==========
问题补充:
-- :: [Note] RSA private key file not found: /var/lib/mysql//private_key.pem. Some authentication plugins will not work.
-- :: [Note] RSA public key file not found: /var/lib/mysql//public_key.pem. Some authentication plugins will not work.
A random root password has been set. You will find it in '/root/.mysql_secret'.
-- :: [Note] Binlog end
新版本的mysql安装过程中创建一个新的随机密码:
[root@rusky~]# cat .mysql_secret
# The random password set for the root user at Tue Apr 14 17:13:09 2015 (local time): VUbNaGLLtAU546Nh
登录命令:mysql -uroot -pVUbNaGLLtAU546Nh --使用文件中的随机密码可正常登录。
[root@NOP6-citrix01 local]# mysqladmin -uroot -p password --修改密码
Enter password: VUbNaGLLtAU546Nh
New password: 新密码
Confirm new password: 新密码
[root@NOP6-citrix01 local]#
MySQL ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO的更多相关文章
- Mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost'(using password: YSE)
安装mysql后,使用命令登录mysql居然报错了,Mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost'(using ...
- MySQL ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)的真正原因
在博客Linux mysql 5.6: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: N ...
- [mysql] ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES).
用mysql -u root -p显示ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YE ...
- MySQL ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) 的解决办法和原因
这两天下载了MySQL5.7.11进行安装,发现到了初次使用输入密码的时候,不管怎样都进不去,即使按照网上说的在mysqld 下面添加skip-grant-tables也是不行,后来研究了两天,终于找 ...
- Linux mysql 5.6: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
案例环境: 操作系统 :Red Hat Enterprise Linux Server release 5.7 (Tikanga) 64 bit 数据库版本 : Mysql 5.6.19 64 bit ...
- mysql 链接失败(ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES))
mysql链接失败(ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)) 修改: # ...
- 安装mysql因为/tmp权限不足而导致ERROR 1045 (28000): Access denied for user root@localhost (using password: NO)的解决方案
本机是centos 6.5 安装的mysql是5.1的版本. 在安装mysql之后,第一次启动mysql服务的时候,需要/tmp有777(rwxrwxrwx)的权限,然而楼主的/tmp是755(rw ...
- MySQL学习笔记——ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) Enter password: E ...
- 重置密码解决MySQL for Linux错误 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
出现报错: Warning: World-writable config file '/etc/my.cnf' is ignored // 该文件权限过高ERROR 1045 (28000): Acc ...
随机推荐
- ORA-25154/ORA-01748
SQL> select oi.order_id,product_id,order_date from order_items oi join orders o using(order_id) w ...
- EffectiveC#11--选择foreach循环
1.C#的foreach语句可以为你的任何集合产生最好的迭代代码 不推荐如下写法(?原因未明白 作者意思是阻碍jit边界检测) int len = foo.Length; for ( int inde ...
- BOM 窗体相关属性以及页面可见区域的获取方式
1 在IE Safari Oper Chrome 都提供了screenLeft和screenTop属性: screenLeft : 相对于屏幕左边的距离 screenTop : 相对于屏幕上边的距离 ...
- ORA-00937:不是单组分组函数_Oracle
Demo: SELECT USER_ID, USER_NAME, USER_SEX, MAX(USER_AGE), SUM(USER_MONEY) AS USER_MONEY USER_TEL, US ...
- ExtJS 饼状图报表
简单的ExtJS饼状图报表. 先上源码,咱再慢慢解析: Ext.onReady(function(){ var store = Ext.create('Ext.data.JsonStore', { f ...
- Ext JS中Button的一般使用
Ext JS中Button按钮的显示,以及按钮的部分事件 一.属性 renderTo:将当前对象所生成的HTML对象存放在指定的对象中 text:得到按钮名称 minWidth:按钮最小宽度 hidd ...
- 32位的CPU最多只能支持最大到4GBytes的内存
和总线宽度相似的,CPU每次能够处理的数据量称为字组大小(word size), 字组大小依据CPU癿设计而有32位与64位.我们现在所称的计算机是32或64位主要是依据这个 CPU解析的字组大小而来 ...
- 【转】生产环境MySQL Server核心参数的配置
⑴ lower_case_table_names ● 推荐理由 GNU/Linux 平台,对数据库.表.存储过程等对象名称大小 ...
- EF 请求数据是缓存 求大神解释
// //AliexpressEntities MyaliexpressEntities 为了事物一致性 在别的方法里面传过来的 实质还是 ( AliexpressEntities aliexpre ...
- WPF安装部署小结
开机启动 右击"MySetup">>"视图">>"注册表",在"HKEY_LOCAL-MACHINE&qu ...