登录报决绝访问

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

1、vim /etc/my.cnf ,在[mysqld] 最后添加一行(跳过授权) skip-grant-tables 2、保存后重启mysql

service mysqld restart  

3、输入以下命令,回车后输入密码再回车登录Mysql

mysql -uroot -p mysql  

4、选择数据库

use mysql;

5、重新设置密码,其中 your_pwd 部分改为你自己想要设置的密码 (5.7以上版本password为authentication_string)

mysql>update user set authentication_string=password("your_pwd") where user='root';  

6、刷新权限

mysql>flush privileges;

7、 注释第一步的跳过授权

8、重启mysql(第二步)

9、再试试~ ~ ~

Comments
  • Latest
  • Oldest
  • Hottest
Powered by Waline v2.15.5