使用Mysql -uroot -p,然后输入密码登录mysql时,出现了如下错误: ERROR 1045 (28000): Access denied for user "root"@"localhost" (using passWord
使用Mysql -uroot -p,然后输入密码登录mysql时,出现了如下错误:
ERROR 1045 (28000): Access denied for user "root"@"localhost" (using passWord: YES)
一般这个错误是由密码错误引起,解决的办法自然就是重置密码
解决方案如下:
停止mysql数据库:systemctl stop mysqld
用以下命令启动MySQL,以不检查权限的方式启动:
mysqld --skip-grant-tables &
此时又报了一个错误:2018-02-01T02:52:55.093724Z 0 [ERROR] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!
执行命令:mysqld --user=root --skip-grant-tables &
登录mysql:mysql -uroot或mysql
更新root密码
mysql5.7以下版本:UPDATE mysql.user SET Password=PASSWORD("123456") where USER="root";
mysql5.7版本:UPDATE mysql.user SET authentication_string=PASSWORD("123456") where USER="root";
刷新权限:flush privileges;
退出mysql:exit或quit
使用root用户重新登录mysql
mysql -uroot -p
Enter password:<输入新设的密码123456>
--结束END--
本文标题: 解决MySQL登录报ERROR 1045 (28000): Access denied for user 'root'@'localhost&am
本文链接: https://www.lsjlt.com/news/2630.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-05-03
2024-05-03
2024-05-03
2024-05-03
2024-05-03
2024-05-03
2024-05-03
2024-05-03
2024-05-03
2024-05-03
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0