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 改成具体的权限关键字,权限列表如下图所示:

mysql用户授权

示例:

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'

 

相关文章:

  • 2022-12-23
  • 2021-12-10
  • 2021-07-02
  • 2021-07-06
  • 2021-05-19
  • 2021-07-01
  • 2021-08-25
  • 2022-03-10
猜你喜欢
  • 2021-05-28
  • 2022-12-23
  • 2022-01-07
  • 2021-09-04
  • 2021-10-21
  • 2022-02-04
相关资源
相似解决方案