1.远程端口未开
2.Mysql 数据库中user表
2.1 用户名root 的host字段味更改为% 允许远程访问;
use mysql; SELECT user,host,plugin,authentication_string FROM user;
user host plugin authentication_string root % auth_socket debian-sys-maint localhost caching_sha2_password $A 005 005 005 SWNdTeAjySeUwspsURgzyZP4urfCS6gwP5zb5HAZFPZLs0 %c; B_ mysql.infoschema localhost caching_sha2_password $A 005 005 005 THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED mysql.session localhost caching_sha2_password $A 005 005 005 THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED mysql.sys localhost caching_sha2_password $A 005 005 005 THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED
2.2 用户名root 的plugin字段未更改为使用密码验证;
auth_socket 值更改为 caching_sha2_password
ALTER USER 'root' @'%' IDENTIFIED WITH caching_sha2_password BY 'XXXXXXXXXXX' ;
user host plugin authentication_string root % caching_sha2_password *7C0C95B5A24D8ED3A3B4A771C6C8E7713D5CEAE1 debian-sys-maint localhost caching_sha2_password $A 005 005 005 SWNdTeAjySeUwspsURgzyZP4urfCS6gwP5zb5HAZFPZLs0 %c; B_ mysql.infoschema localhost caching_sha2_password $A 005 005 005 THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED mysql.session localhost caching_sha2_password $A 005 005 005 THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED mysql.sys localhost caching_sha2_password $A 005 005 005 THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED
3. 服务器 中 mysql配置表
通常路径在 /etc/mysql/mysql.conf.d/mysqld.cnf
sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf
bind-address 配置未配置成 bind-address = 0.0.0.0;