当前位置: 移动技术网 > IT编程>数据库>Mysql > mysql 开放外网访问权限的方法

mysql 开放外网访问权限的方法

2019年05月30日  | 移动技术网IT编程  | 我要评论

如下所示:

主要执行授权命令:

两种方式

1. 允许任意主机以用户bd和密码bdpw连接到local服务器

mysql> grant all privileges on *.* to 'bd'@'%' identified y 'bdpw' with grant option;
mysql> flush privileges;

2. 允许特定的ip地址以用户bd和密码bdpw连接到local服务器

mysql> grant all privileges on *.* to 'bd'@'172.16.4.198' dentified by 'bdpw' with grant option; 
mysql> flush privileges;

注意:

1. 在command line client输入密码 或 进入nivacat的命令行界面,

2. 输入:use mysql;

3. 查询host输入: select user,host from user;

如果有host值为%的,则直接执行授权语句;如果没有,则执行第4步

4. 创建host

如果没有”%”这个host值,选择某个开放出去的用户(bd),执行

mysql> update user set host='%' where user='bd'; 
mysql> flush privileges; 

5. 授权用户*.* 表明授权所有权限

mysql> grant all privileges on *.* to 'bd'@'%' identified by 'bdpw' with grant option; 
mysql> flush privileges; 

以上这篇mysql 开放外网访问权限的方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持移动技术网。

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网