【MYSQL】MySQL语句记录

限制ip访问

1
2
GRANT ALL PRIVALEGES ON *.* TO 'root'@'127.0.0.1' IDENTIFIED BY '<密码>';
flush privileges;

限制用户最大连接数

1
grant all on customer.* TO '数据库名'@'localhost' with MAX_USER_CONNECTIONS 4 MAX_CONNECTIONS_PER_HOUR 1000;

查看所有链接客户端

1
select substring_index(host, ':', 1) as host_name , state , count(*) from infomation_schema.processlist group by state,host_name;

持续更新…