从其他电脑访问本机的Mysql的设置方法
时间:2024-01-17 10:25:57
If you want to give a specific user access from all machines in a given domain (for example, mydomain.com), you can issue a GRANT statement that uses the ‘%' wildcard character in the host part of the account name:
译文:如果需要让特定的用户从给定域(例如mydomain.com)的所有计算机上访问 MySQL 服务器,你可以执行在账户名的 host 部分使用了通配符“%” 的 GRANT 语句
mysql> GRANT ...
-> ON *.*
-> TO 'myname'@'%.mydomain.com'
-> IDENTIFIED BY 'mypass';
To do the same thing by modifying the grant tables directly, do this:
译文:也可以使用直接修改授权表的方式来实现:
mysql> INSERT INTO user (Host,User,Password,...)
-> VALUES('%.mydomain.com','myname',PASSWORD('mypass'),...);
mysql> FLUSH PRIVILEGES;
再来解决问题:
一、允许用户 wp 从 192.168.2.98 登录 MySQL 服务器(下面的实例均为登录服务器192.168.2.28)
(1)先在MySQL中授权:grant select,update,insert,delete on mysql.* to 'wp'@'192.168.2.98' identified by '123';
(2)再用VFP连接:SQLSTRINGCONNECT("driver={mysql odbc 3.51 driver};server=192.168.2.28;uid=wp;pwd=123;port=3306;")
如果有多个网址,分别执行授权就可以了。
二、允许用户 wp 从某个网段登录 MySQL 服务器
(1)先在MySQL中授权:grant select,update,insert,delete on mysql.* to 'wp'@'192.168.2.%' identified by '123';
(2)再用VFP连接:SQLSTRINGCONNECT("driver={mysql odbc 3.51 driver};server=192.168.2.28;uid=wp;pwd=123;port=3306;")
三、允许用户 wp 从任何网址登录 MySQL 服务器
(1)先在MySQL中授权:grant select,update,insert,delete on mysql.* to 'wp'@'%' identified by '123';
(2)再用VFP连接:SQLSTRINGCONNECT("driver={mysql odbc 3.51 driver};server=192.168.2.28;uid=wp;pwd=123;port=3306;")
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
pip指定python位置安装软件包的方法
Python光学仿真教程实现光线追踪
![](https://img.aspxhome.com/file/2023/1/64701_0s.png)
python批量解压zip文件的方法
详解利用python+opencv识别图片中的圆形(霍夫变换)
![](https://img.aspxhome.com/file/2023/4/92354_0s.jpg)
python中利用xml.dom模块解析xml的方法教程
Go语言时间处理必备技巧全解析
Javascript调试之console对象——你不知道的一些小技巧
![](https://img.aspxhome.com/file/2023/4/55904_0s.jpg)
Javascript网页抢红包外挂实现分享
python对excel文档去重及求和的实例
python时间序列按频率生成日期的方法
DW CS4初步试用感受
![](https://img.aspxhome.com/file/uploadpic/20085/30/2008530125042602.gif)
Python使用time模块实现指定时间触发器示例
![](https://img.aspxhome.com/file/2023/0/82760_0s.png)
python3字符串输出常见面试题总结
python数据解析BeautifulSoup爬取三国演义章节示例
![](https://img.aspxhome.com/file/2023/2/104982_0s.jpg)
我的快递一个月没动静于是赶紧上线python快递查询系统
![](https://img.aspxhome.com/file/2023/8/87698_0s.png)
Python+Opencv实现表格边框线检测
![](https://img.aspxhome.com/file/2023/1/61971_0s.png)
用unescape反编码得出汉字示例
FFrpc python客户端lib使用解析
Python图像处理库PIL中图像格式转换的实现
![](https://img.aspxhome.com/file/2023/0/127680_0s.jpg)