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

从其他电脑访问本机的Mysql的设置方法

2024/4/8 20:37:40发布10次查看
如果需要让特定的用户从给定域(例如mydomain.com)的所有计算机上访问 mysql 服务器,你可以执行在账户名的 host 部分使用了通配符“%” 的 grant 语句
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;)
该用户其它信息

VIP推荐

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