【1】查看mysql数据库中的所有用户
SELECT DISTINCT CONCAT('User: ''',user,'''@''',host,''';') AS query FROM mysql.user;
【2】查看某个用户的权限
show grants for 'nextcloud'@'%';
or
select * from mysql.user where user='root' \G;
【3】查看当前用户
select user();
【4】修改用户密码
use mysql;
UPDATE user SET password=PASSWORD('新密码') WHERE user='用户';
flush privileges;
【5】修改用户权限及密码
grant 权限 on 库名.表名 to '用户名'@’网段‘ identified by "该用户的密码";
grant all privileges on nextcloud.* to 'nextcloud'@'%' identified by 'du..olctx..entest.1';
【6】删除用户
drop user 'nextcloud'@'%';
【7】补充
mysql数据库授权链接如下:
https://blog.csdn.net/GX_1_11_real/article/details/81200566
ps:
所有案例的数据库都是测试库,怎么可能发 生成数据库,所以看着用户较少,权限设置也没有三权分立原则