LInux ubuntu上开放mysql远程连接,需要2个步骤:
1.修改 /etc/mysql/my.cnf
找到bind-address = 127.0.0.1注释掉或者修改成bind-address = 0.0.0.0
2.进入mysql修改远程权限
mysql -uroot -ppasswd
grant all privileges on *.* to 'root'@'%' identified by 'passwd' with grant option;
flush privileges;
exit;
重启mysql sudo /etc/init.d/mysql restart
3. 打开防火墙端口
sudo ufw allow mysql (或者3306)
通过sudo ufw allow status查询