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