ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)

(1)第一次安装mysql报错:ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)
原因解析:
C:\work\mysql-8.0.16-winx64\bin\mysqld --defaults-file="C:\work\mysql-8.0.16-winx64\my.ini"  -console -skip-grant-tables 这个无效。应为下面执行语句:
C:\work\mysql-8.0.16-winx64\bin\mysqld --defaults-file=C:\work\mysql-8.0.16-winx64\my.ini --console --skip-grant-tables --shared-memory

 

(2)然后navicat 12连接数据库报错:2059-Authrntication plugin 'caching_sha2_password' cannot be loaded
原因解析:
因为最新的mysql 8.0.16 安全加密方式为caching_sha2_password,而navicat 12加密方式为mysql_native_password ;
固修改mysql加密方式:
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'admin';

(3)ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)
解决方案:

注释my.ini文件里面的skip_grant_tables

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

输入:mysql -uroot -p  ,空密码进入项目。然后修改密码,退出重新登录即可。

详细教程:   https://blog.csdn.net/sinat_31057219/article/details/84402896

你可能感兴趣的:(node,数据库)