Linux開啟mysql遠端連線,linux開啟mysql

來源:互聯網
上載者:User

Linux開啟mysql遠端連線,linux開啟mysql

Linux開啟mysql遠端連線的設定步驟 .
mysql遠端連線linuxserviceserveruserMysql預設root使用者只能本地訪問,不能遠端連線管理mysql資料庫,Linux如何開啟mysql遠端連線?設定步驟如下:
1、GRANT命令建立遠端連線mysql授權使用者test
mysql -u root -p
mysql>GRANT ALL PRIVILEGES ON *.* TO test@localhost IDENTIFIED BY 'test' WITH GRANT OPTION;
mysql>GRANT ALL PRIVILEGES ON *.* TO test@"%" IDENTIFIED BY 'test' WITH GRANT OPTION;

第一句增加itlogger使用者授權通過本地機(localhost)訪問,密碼'test'。第二句則是授與test使用者從任何其它主機發起的訪問(萬用字元%)。
2、設定防火牆允許3306連接埠
vi /etc/sysconfig/iptables
添加
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
(注意添加在-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited之前,否則可能導致規則不生效)
重啟防火牆service iptables restart

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.