风-fmgao

导航

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

pycharm 创建数据库报错

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

win:解决方法

1.管理员身份运行cmd

2.net stop mysql

3.运行命令  mysqld --skip-grant-tables,这是光标会一直闪

4.再管理员打开新cmd

5.进入mysql>use mysql;

6.mysql>select * from user;

7.这里如果显示的是 authentication_string(新版的5.7以后吧)就执行

mysql>update user set authentication_string=password("root") where user="root";

如果显示的是password 就执行

mysql>update user set password=password("root") where user="root";
---------------------
8.flush privileges;

下次再登录的时候输入密码就是了比如 mysql -uroot -proot就直接登录了

posted on 2018-10-15 09:53  风-fmgao  阅读(724)  评论(0编辑  收藏  举报