ubuntu安装mysql 并对外暴露3306端口
安装 sudo apt-get install mysql-client mysql-server
-
vi /etc/mysql/mysql.conf.d/mysqld.cnf
bind 127注掉 -
mysql.user 授权
update mysql.user set host = ‘%’ where username = ‘root’ -
Allow firewall ports
sudo ufw allow 3306/tcp
sudo ufw allow 3306
sudo ufw allow 8080/tcp
sudo ufw allow 8080
sudo service ufw restart -
云主机或docker 是否对外暴露
-
sudo service mysql restart
sudo netstat -tap | grep mysql