mysql 允许特定IP访问

时间:2021-01-11 03:33:42
 

1. 测试是否允许远程连接

$ telnet 192.168.1.8 3306
host 192.168.1.4 is not allowed to connect to this mysql server

2. 允许特定客户端 ip 地址连接

$ mysql -u root -p
Enter password: mysql> use mysql mysql> GRANT ALL ON *.* to root@'192.168.1.4' IDENTIFIED BY 'mysql-root-password'; mysql> FLUSH PRIVILEGES;
注意:mysql-root-password 服务器 mysql 的密码