admin avatar

MySQL adds the user with the least authority and the method of restricting the user to occupy system resources

🕞 by admin





Add the user with the least privilege of MySQL and the method to restrict the user to occupy system resources

Generally open IDC or virtual hosting provider, the co-leasing can use this demand. .

Limit the permissions of the MySQL user and set restrictions on the user's occupation of system resources. . . code show as below

1
2
3
4
5
6
7
use mysql;
SHOW COLUMNS FROM `mysql`.`user`;
SELECT `user`, `host`, authentication_string AS `password` FROM `mysql`.`user`;
CREATE USER 'demo'@'127.0.0.1' IDENTIFIED BY 'demo';
GRANT EXECUTE, PROCESS, SELECT, SHOW DATABASES, SHOW VIEW, CREATE USER, FILE, LOCK TABLES, RELOAD, REPLICATION CLIENT, SHUTDOWN, REPLICATION SLAVE, SUPER  ON *.* TO 'demo'@'127.0.0.1' WITH GRANT OPTION MAX_QUERIES_PER_HOUR 100 MAX_UPDATES_PER_HOUR 300 MAX_CONNECTIONS_PER_HOUR 200 MAX_USER_CONNECTIONS 150;
FLUSH PRIVILEGES;
SHOW GRANTS FOR 'demo'@'127.0.0.1';

The command sets the demo user system resource limits as follows

100 queries per hour

300 updates per hour

200 connections per hour

150 parallels per hour





💘 相关文章


📝 有偿服务

• 服务器合租380/年
• 服务器配置:2.4G,6核12线程
• nvme raid 1硬盘
• 不提供服务器自主面板
• 适合稳定的个人博客
• 提供备份服务,备份空间自备
• 只提供ipv6地址,搭配cloudflare使用
• 提供想要安装的程序和域名
• 博客必须是和谐健康的
• 博客不能是视频和图片站
• 提供以下付费服务
• 建站,FTP,备份,Linux,Wordpress等建站问题咨询管理
• 加微信:344452500(不闲聊,直接说事)

写一条评论

Based on Golang + fastHTTP + sdb | go1.16.8 Processed in 0ms