use mysql; grant all privileges on share.* to 'abc'@'192.168.6.100' identified by '123456'; flush privileges;
上面命令的意思是:将share数据库的所有表权限分配给 ip 为 192.168.6.100 的电脑用户,使用用户名(abc)和密码(123456)可以登录
PS1:如果不想分配全部权限,可以自己把all privileges 改成具体的权限关键字,权限列表如下图所示:
示例:
grant SELECT on share.* to 'abc'@'192.168.6.100' identified by '123456'
PS2:如果想指定多个ip,要授权多次,示例:
grant SELECT on share.* to 'abc'@'192.168.6.39' identified by '123456' grant SELECT on share.* to 'abc'@'192.168.6.100' identified by '123456'
PS3:如果开放所以ip访问,直接用%就行了,示例:
grant SELECT on share.* to 'abc'@'%' identified by '123456'