设置mysql允许远程访问


设置mysql允许远程访问
1.登陆mysql数据库,修改表。
use mysql;
update user set host='%' where user='root';
select host,user from user;
flush privileges;

注意:最后一句很重要,目的是使修改生效,如果没有写,则还是不能进行远程连接。

2.授权用户,允许从任何主机连接到mysql数据库。
grant all privileges on *.* to 'root'@'%' identified by 'pwd' with grant option;
flush privileges;

如果只是允许用户从ip为192.168.1.104的主机连接到mysql服务器。
grant all privileges on *.* to 'root'@'%192.168.1.104' identified by 'Fmty_888_!@#' with grant option;
flush privileges;


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM