Linux mysql 5.6: ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: YES)
[[email protected] init.d]# /etc/rc.d/init.d/mysqld stop
[[email protected] init.d]# mysqld_safe --user=mysql --skip-grant-tables --skip-networking & CTRL+C
[[email protected] init.d]# mysql -u root mysql
mysql> update user set password=PASSWORD(‘newpassword‘)
-> where user=‘root‘ and host=‘root‘ or host=‘localhost‘;
mysql> flush privileges;
mysql> quit
[[email protected] init.d]# /etc/rc.d/init.d/mysqld restart
[[email protected] init.d]# mysql -u root -p
Enter password: (输入新密码即可,有可能要多刷几次)
时间: 2024-12-20 12:45:37