mysql的授权语句为
grant all privileges on . to ‘user’@‘ip’ identified by ‘password’ with grant option;
其中*.* 第一个代表库名 第二个代表库的表名 . 表示所有库的所有表 慎用!

mysql通过
create user shanghui identified by ‘shanghui123’;
语句创建普通用户,注意该语句创建时会自动对所有ip开放。即host为%

如需对特定ip开放 可使用
create user ‘shanghui’@'x.x.x.x’identified by ‘shanghui123’;

mysql 权限表一般为mysql.user表
可以用过select host,user from mysql.user 查询给哪些ip授了怎样的权限。
mysql创建普通用户和查询权限

然后通过show grant for ‘user’@‘host’查看授予了什么权限
mysql创建普通用户和查询权限
如果不加@host 默认为show grant for ‘user’@’%’

查询的结果会自动隐藏掉密码,如果需重新授权,需添加identified by ‘password’

相关文章: