二维码

Fix mySQL login error 1045 (28000): Access denied for user 'root' slocalhost' (using password: YES)

1632 人阅读 | 时间:2019年10月17日 09:38

Using mysql -uroot -p, and then entering a password to log in to mysql, the following error occurs:

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

s

Generally this error is caused by a password error, the solution is naturally to reset the password

The solution is as follows:

1. Stop mysql database: systemctl stop mysqld

2. Start MySQL with the following command and start it without checking permissions:

mysqld --skip-grant-tables

Another error was reported: 2018-02-01T02:52:55.093724Z 0 smh.com.au to run mysqld as root!

Execute commands: mysqld --user-root--skip-grant-tables-tables

3. Login mysql:mysql -uroot or mysql

4. Update root password

mysql5.7 the following version: UPDATE mysql.user SET Password s password ('123456') where USER 'root';

mysql5.7 version: UPDATE mysql.user SET s-s-s-string-PASSWORD ('123456') where USER-'root';

5. Refresh permission: flush privileges;

6. Exit mysql:exit or quit

7. Re-login mysql with root user

mysql -uroot -p

Enter the new password 123456

————————————————


©著作权归作者所有:来自ZhiKuGroup博客作者没文化的原创作品,如需转载,请注明出处,否则将追究法律责任 来源:ZhiKuGroup博客,欢迎分享。

评论专区
  • 昵 称必填
  • 邮 箱选填
  • 网 址选填
◎已有 0 人评论
搜索
作者介绍
30天热门
×
×
本站会员尊享VIP特权,现在就加入我们吧!登录注册×
»
会员登录
新用户注册
×
会员注册
已有账号登录
×