admin管理员组

文章数量:1542780

1、首先查看MySQL用户权限:

show grants for 你的用户

比如:查看chai用户的权限
show grants for “chai”@“localhost”;    localhost代表chai用户的本地权限

show grants for “chai”@“%”;    localhost代表chai用户的外部连接权限

说明:ALL: 允许做任何事(和root一样)。
          USAGE: 只允许登录--其它什么也不允许做。

2、查询后没有任何权限(一般新创建的用户是没有任何权限的)

grant all privileges on *.* to 'chai'@'127.0.0.1' identified by '666666';
# 赋予新用户,从本地操作所有数据库.所有数据表的所有权限
 
grant all privileges on *.* to 'chai'@'%' identified by '666666';
# 赋予新用户,从外部操作所有数据库.所有数据表的所有权限(没有外部客户端的IP限制,但本地有限制)

3、最后,刷新权限,使权限立即生效:

flush privileges;

参考文章:https://blog.csdn/lamp_yang_3533/article/details/79367387

本文标签: 普通用户权限mysqlroot