1、结束当前正在运行的mysql进程。

# /etc/init.d/mysql stop

2、用mysql安全模式运行并跳过权限验证。

# mysqld_safe --skip-grant-tables & mysql -uroot

3、修改root用户口令。

use mysql;
//假设新密码:root

update user set password=PASSWORD('root') where User='root';
//if(这句不行) 试下一句!

update mysql.user set authentication_string=password('root') where user='root' ;

4.

update user set plugin="mysql_native_password";
quit;

5.restart

/etc/init.d/mysql stop
kill -9 $(pgrep mysql)
/etc/init.d/mysql start

Done deal!

dawei

【声明】:唐山站长网内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。