mysql报错access denied for user 'root'@'localhost'(using password: NO或YES)

完整步骤:

1.修改mysql的my.ini文件,在[mysqld]后面加上“skip-grant-tables”。

2.点击“重新启动所有服务”(WampServer)。

3.通过DOS进入数据库(此时无需密码可直接进入)

输入以下代码:

USE mysql;
UPDATE user SET authentication_string=PASSWORD('密码字符串') WHERE user='root';    
/*
authentication_string字段是Navicat For MySQL(11.1.13)的root密码字段。
PASSWORD()为mysql修改root密码函数。
*/
flush privileges; #刷新MySQL的系统权限。
\q #退出mysql

4.删除步骤1中添加的"skip-grant-tables"。

5.点击“重新启动所有服务”(WampServer)。

完毕!

posted @ 2018-03-18 18:19  哟风  Views(196)  Comments(0)    收藏  举报