mysql配置白名单

参考自文章    https://blog.csdn.net/hanshileiai/article/details/46375449


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 'your-root-password'; 

mysql> FLUSH PRIVILEGES;

注意: your-root-password 填写你的服务器 mysql 的密码

如果不知道自己的公网ip,百度一下ip,就可以看到了!,有时还会错,根据报错信息调整即可,不过好像公网Ip会被还是什么的,可以配成识别ip网段的就不会有问题了,

GRANT ALL ON *.* to root@'119.143.12..%' IDENTIFIED BY 'password'; %表示通配的意思

猜你喜欢

转载自blog.csdn.net/zxc_user/article/details/80628214