mysql 8.0的
1,检查服务器mysql 服务是否启动 10061
2,mysql必须设置密码,不然报错10061
use mysql; update user set authentication_string=“” where user=“root”; flush privileges; ALTER USER ‘root’@’%’ IDENTIFIED WITH mysql_native_password BY ‘密码’;
3,select Host,User from user; 查看 root 把root的host 设置成%, 刷新一下 flush privileges;
重启一下mysql服务 systemctl stop mysqld systemctl start mysqld