zhuangjie
ZhuangJie

1、云服务器要开放tcp 3306端口

登录云服务器提供商的,添加开放端口

 

2、配置mysql允许非本地连接

编辑:/etc/my.cnf 或(如果配置了不生效) /etc/mysql/mysql.conf.d/mysqld.cnf

修改:

...

[mysqld]
bind-address = 0.0.0.0

...

重启mysql:systemctl restart mysql

验证:mysql> SHOW GLOBAL VARIABLES LIKE 'bind_address';  # 如果是0.0.0.0就表示允许其它ip访问了

posted on 2025-09-17 21:38  zhuangjie  阅读(6)  评论(0)    收藏  举报