失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > ubuntu下 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)的解决方案

ubuntu下 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)的解决方案

时间:2018-07-28 16:57:32

相关推荐

ubuntu下 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)的解决方案

ubuntu下,ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: NO)的解决方案

环境:ubuntu 18.04

1.命令行输入:sudo vi /etc/mysql/mysql.conf.d/f

在[mysqld]后面任意一行添加“skip-grant-tables”用来跳过密码验证的过程

保存文档并退出

2.接下来我们需要重启MySQL:/etc/init.d/mysql restart

显示如下:

[…] Restarting mysql (via systemctl): mysql.serviceFailed to add /run/systemd/ask-password to directory watch: No space left on device

. ok

3.重启之后输入#mysql即可进入mysql。

4.接下来就是用sql来修改root的密码

mysql> use mysql;

mysql>update mysql.user set authentication_string=password(‘123456’) where user=‘root’;

mysql> flush privileges;

mysql> quit

到这里root账户就已经重置成新的密码了。

sudo vi /etc/mysql/mysql.conf.d/f

编辑f,去掉刚才添加的“skip-grant-tables”内容,然后重启MySQL,

/etc/init.d/mysql restart ,使用mysql -u root -p123456 即可进入mysql。

转自:/jaray/article/details/88999305

如果觉得《ubuntu下 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)的解决方案》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。