注释掉配置文件中的bind-address
vim /etc/mysql/mysql.conf.d/mysqld.cnf
授权并刷新权限
grant all on *.* to root@'%' identified by '密码' with grant option;
flush privileges;
root的plugin被修改成了auth_socket,用密码登陆的plugin应该是mysql_native_password。
update mysql.user set authentication_string=PASSWORD('你的密码'), plugin='mysql_native_password' where user='root';
重启服务,问题就解决了
service mysql restart
配置3306端口的访问权限