首页 > 代码库 > Linux mysql ERROR 1045 解决

Linux mysql ERROR 1045 解决

Linux mysql 5.6: ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: YES)

[root@DB-Server init.d]# /etc/rc.d/init.d/mysqld stop

[root@DB-Server init.d]# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &

CTRL+C

[root@DB-Server 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

[root@DB-Server init.d]# /etc/rc.d/init.d/mysqld restart

[root@DB-Server init.d]# mysql -u root -p
Enter password: (输入新密码即可,有可能要多刷几次)

Linux mysql ERROR 1045 解决