连接数据库时出现报错(windows 情况下用 navicat 连接 时)

1045 access denied for user 'root'@'localhost' using password yes

作者 :许端阳

解决办法

1 由于我用的redhat 6.5 64 位  内置的是mysql 5.1  其中的配置文件的位置在 /etc/my.cnf

2 #service mysqld restart 重启mysql

3./etc/my.cnf 文件中 找到  [mysqld]  然后在下面加上

     这句: skip_grant_tables (意思好像是 启动MySQL服务的时候跳过权限表认证  )

4. mysql> use mysql; (连接权限数据库)。

5. 改密码:update user set password=password("123") where user="root";(别忘了最后加分号) 。

6 mysql>commit;

7. 刷新权限(必须步骤):mysql>flush privileges; 。 

8. 退出 quit。 

9. /etc/my.cnf 里的 skip_grant_tables  去掉(启动MySQL服务的时候不能让他跳过权限表认证 )

10. 重启MySQL ,再进入,使用用户名root和刚才设置的新密码123就可以登录了

posted on 2017-10-30 23:50  垃圾分类网  阅读(786)  评论(0)    收藏  举报