Host ‘xx.xx.xx.xx’ is not allowed to connect to this MySQL server
注:需要在服务器登录mysql终端
改表法
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
mysql> use mysql; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A
Database changed mysql> update user set host = '%' where user = 'root';//需要远程连接的用户 mysql> select host,user from user; +-----------+-----------+ | host | user | +-----------+-----------+ | % | root | | localhost | mysql | | localhost | mysql.sys | +-----------+-----------+ 3 rows in set (0.00 sec)
授权法
1 2 3 4 5
mysql> GRANT ALL PRIVILEGES ON *.* TO 'mysql'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION; //mysql 密码强度有验证;mypassword:密码 Query OK, 0 rows affected, 1 warning (0.00 sec)