Ubuntu Mysql開通外網訪問權限


1、編輯 my.cnf 文件:

sudo vi /etc/mysql/my.cnf
 
2、將綁定地址行注釋掉或者修改為指定 IP
#bind-address = 127.0.0.1
 
3、登錄 MySQL:
mysql -uroot -p密碼
 
4、添加 root 用戶訪問權限
grant all privileges on *.* to 'root'@'%' identified by '密碼';
flush privileges;
 
5、查看 user 權限,成功修改權限為 %:
select host,user from mysql.user;
+------------+----------------+
| host         | user             |
+------------+----------------+
| %             | root             |
| 127.0.0.1 | root             |
| localhost  | root             |
+------------+----------------+
 
6、重啟 MySQL:
sudo /etc/init.d/mysql restart


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM