1.Can’'t connect to MySQL server on localhost (10061)解决方法
- 管理员命令启动cmd
- 输入mysqld --initialize-insecure --user=mysql
- 然后输入mysqld --install mysql
- net start mysql
- mysql -uroot -p
进入到下一个错误
2.ERROR 1045 (28000): Access denied for user ‘ODBC’@‘localhost’ (using password: NO)
- 同上,先关掉mysql:
net stop mysql
- 删掉目录下的data文件:
- mysqld --initialize --console 重新生成data文件,这时候会初始化root的密码:
- 然后重启mysql:
net start mysql
- 登录
mysql -uroot -p
- ALTER user ‘root’@‘localhost’ IDENTIFIED BY ‘你想改的密码’;
进入到下一个错误
3.2059-authentication plugin ‘caching_sha2_password’
- 查看一下加密的方式:
show variables like 'default_authentication_plugin';
- 查看本地mysql用户的信息:
select host,user,plugin from mysql.user;
- 更改指定账号的加密方式:
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '你的密码';
成功:
期间可能出现反复,尽量按照提示对症下药。