今天公司的CentOS服务器的mysql怎么都登录不了,无奈找度娘问了下,下面方法很快搞定了我的问题,感谢啊,总结如下:
提示:1045 access denied for user 'root'@'localhost' using password yes
方法一:
# /etc/init.d/mysql stop
# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
# mysql -u root mysql
mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root';
mysql> FLUSH PRIVILEGES;
mysql> quit
# /etc/init.d/mysql restart
# mysql -uroot -p
Enter password: <输入新设的密码newpassword>
文章的脚注信息由WordPress的wp-posturl插件自动生成
微信扫一扫,打赏作者吧~
![[已解决]nc命令报错 close: Bad file descriptor](http://www.jyguagua.com/wp-content/themes/begin/timthumb.php?src=http://www.jyguagua.com/wp-content/uploads/2022/03/Snipaste_2022-03-18_20-16-48.png&w=280&h=210&zc=1)
![[整理]sublime text3定义快速代码块模板](http://www.jyguagua.com/wp-content/themes/begin/timthumb.php?src=http://www.jyguagua.com/wp-content/uploads/2020/12/1.png&w=280&h=210&zc=1)
![[已解决]win10 bitlocker解除,移除锁感叹号](http://www.jyguagua.com/wp-content/themes/begin/timthumb.php?src=http://www.jyguagua.com/wp-content/uploads/2020/12/Snipaste_2020-12-03_19-59-28.png&w=280&h=210&zc=1)