在mysql/ target=_blank class=infotextkey>mysql数据库中为指定的库添加查询权限:
grant select on *.* to tianq@"localhost" identified by "tianq";
给mysql添加一个只有某个数据库查询权限的用户,具体步骤:
1、添加用户:
insert into mysql.user(Host,User,Password,ssl_cipher,x509_issuer,x509_subject) values ("192.168.186.1","allen",password("allen"),'','','');
2、刷新
flush privileges;
3、授权:
grant select on test.* to 'allen'@'192.168.186.1';
刷新:
flush privileges;
查看授权情况:
SHOW GRANTS FOR allen@192.168.186.1;
删除用户:
DROP USER allen@192.168.186.1;