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'; %表示通配的意思

参考 https://blog.csdn.net/zxc_user/article/details/80628214

相关文章:

  • 2021-07-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-02
  • 2021-06-05
  • 2021-11-14
猜你喜欢
  • 2022-01-07
  • 2021-10-18
  • 2022-02-21
  • 2021-12-03
  • 2022-12-23
  • 2022-12-23
  • 2021-10-25
相关资源
相似解决方案