mysql 创建只读账户;
1、查询所有账号信息
SELECT DISTINCT a.`User`,a.`Host`,a.password_expired,a.password_last_changed,a.password_lifetime,a.* FROM mysql.user a;
示例:
1、创建账户 并授权SELECT查询权限。 > GRANT SELECT ON dbname.* TO ‘username‘@‘%‘ IDENTIFIED BY "password"; 2.刷新mysql权限,使用户创建、授权生效。 > FLUSH PRIVILEGES;
2、添加视图的权限:
> UPDATE mysql.`user` a SET a.Show_view_priv=‘Y‘ WHERE a.`User`=‘username‘ and a.`Host`=‘IP‘; > FLUSH PRIVILEGES;
原文地址:https://www.cnblogs.com/sharesdk/p/11305172.html
时间: 2024-10-03 20:56:14