1、修改配置文件
vim /etc/mysql/my.cnf
修改bind-address = 0.0.0.0
2、授权
GRANT ALL PRIVILEGES ON . TO 'root'@'%' IDENTIFIED BY 'sjgj2508' WITH GRANT OPTION;
FLUSH PRIVILEGES;
3、重启mysql
sudo service mysql restart
4、修改防火墙规则
sudo iptables -A INPUT -i eth0 -s 192.168.1.0/24 -p tcp --destination-port 3306 -j ACCEPT