如何在centos7上安裝mysql并實現遠程訪問?
關閉防火墻的情況下
sudo vim /etc/sysconfig/iptables
-A INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
sudo service iptables restart
mysql > use mysql;
#創建openscanner用戶與密碼并設置為從安裝mysql服務的機器本地訪問
mysql > grant all on openscannerstore.* to 'openscanner'@'localhost'
identified by 'scanner888';
#設置openscanner用戶與密碼,并從任何機器都可以訪問mysql
mysql > grant all on openscannerstore.* to 'openscanner'@'%' identified by 'scanner888';
mysql > flush privileges; #刷新才會生效