阿里云轻量级服务器设置mysql监听所有ip,开放给外网

mysql默认是只给本地访问的。
要开放给外网,则
1 :修改配置文件 /etc/mysql/mysql.conf.d/mysqld.cnf

,最后添加 bind-address=0.0.0.0
2:重启 ,ubuntu命令service mysql restart
3:检查效果netstat -anp | grep mysql
出现tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 6688/mysqld 即可
可能错误:
如果将bind-address=0.0.0.0错误的添加在/etc/mysql/my.cnf 这个配置文件里,则重启会报错,信息如下:
mysql.service failed because the control process exited with error code

很多文章说是bind-address=0.0.0.0 要添加在/etc/mysql/my.cnf 里面,我试了,不行的。
参考:https://blog.csdn.net/qq_34332010/article/details/74106747

猜你喜欢

转载自blog.csdn.net/weixin_43855644/article/details/86657435