MySQL adds the user with the least authority and the method of restricting the user to occupy system resources
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
💘 相关文章
- Implementation method of regular backup of MySQL database
- MySQL remote connection configuration method under docker container
- Plesk uninstall and reinstall method
- MySQL8 method to restrict the connection of the intranet IP segment
- Super simple, method for registering program or software as system service under windows system
- Method to cancel ssh key password
- ubuntu系统出现user '_apt'. - pkgAcquire::Run (13: Permission denied)的结局方法
- freebsd Unknown user: 目录名.的解决方法
- Change the user's home directory for centos