MySQL: common query
Query the running connections
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST WHERE User='[username]';
-- or
SHOW PROCESSLIST;
Kill the running connecctions
SELECT CONCAT('KILL ', ID, ';') FROM INFORMATION_SCHEMA.PROCESSLIST WHERE User='[username]';
Get the max_user_connections setting of a user
SELECT max_user_connections FROM mysql.user WHERE User='[username]';
Create user
CREATE USER 'username'@'host' IDENTIFIED BY 'password';
Grant permission to a user
GRANT ALL ON *.* TO 'username'@'host' WITH GRANT OPTION;
FLUSH PRIVILEGES;
Grant permission to a database
GRANT ALL ON db1.* TO 'jeffrey'@'localhost';
Show created procedures
SHOW PROCEDURE STATUS;
Check permission of a DB user
SHOW GRANT FOR 'username'@'hostname';
创建时间:6/25/2022 11:25:11 PM
修改时间:7/30/2022 7:33:32 PM