mysql8 遇到问题:ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)的解决方法

1:先停服务:net stop mysql

2:移除服务:mysqld -remove mysql

3:E:\zyf\mysql8\bin>mysqld -initialize-insecure -user=mysql

4:E:\zyf\mysql8\bin>mysqld -install mysql

5:E:\zyf\mysql8\bin>net start mysql

6:E:\zyf\mysql8\bin>mysql

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

7:E:\zyf\mysql8\bin>mysql -uroot -p

Enter password: *******
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 10   就可以正常登录了!!!

 

如果遇到Navicat连接不上mysql服务:报错:

 

 可以先在DOS命令窗口登录mysql:

然后运行:mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root123';

Query OK, 0 rows affected (0.07 sec)

然后就可以正常登录了:

 

posted @ 2021-09-29 22:35  寻水的鱼001  阅读(335)  评论(0编辑  收藏  举报