您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

设置mysql允许外网访问_MySQL

2024/3/11 19:32:03发布17次查看
bitscn.com
设置mysql允许外网访问
mysql的root账户,我在连接时通常用的是localhost或127.0.0.1,
公司的测试服务器上的mysql也是localhost所以
解决方法如下:
1,修改表,登录mysql数据库,切换到mysql数据库,使用sql语句查
看select host,user from user ;
mysql -u root -pvmwaremysql>use mysql;
mysql>update user set host = '%' where user ='root';
mysql>select host, user from user;
mysql>flush privileges;
注意:最后一句很重要,目的是使修改生效.如果没有写,则还是不能进行远程连接.
2,授权用户,你想root使用密码从任何主机连接到mysql服务器
grant all privileges on *.* to 'root'@'%'  identified by 'admin123'  with grant option;
flush privileges;
如果你想允许用户root从ip为192.168.1.104的主机连接到mysql服务器
grant all privileges on *.* to 'myuser'@'192.168.1.104'   identified by 'admin123'  with grant option; 
flush privileges;
bitscn.com
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product