MySQL用户管理和权限配置

-- 查看数据库中的所有用户
SELECT DISTINCT CONCAT('User: ''',user,'''@''',host,''';') AS query FROM mysql.user;
-- 查看数据库中所有的用户
select host,user,password from mysql.`user`
-- 查看数据库中具体某个用户的权限
show grants for 'soperfee'@'10.68.70.250'
-- 新增用户(用户名:soperfee 密码:123456)
CREATE USER 'soperfee'@'10.68.70.250' IDENTIFIED BY '123456';
-- 如果想指定部分权限给一用户
grant select,insert,create on bpr.* to [email protected] identified by '12346';
-- 撤销已经赋予用户的权限
revoke all on *.* from [email protected];
-- 查询所有用户
select user,host from mysql.user
-- 删除用户
delete from mysql.user where host='localhost'
-- 刷新权限
flush PRIVILEGES;

 

你可能感兴趣的:(MySQL)