1.登录mysql
mysql -uroot -proot123
2.创建新用户
create user 'student'@'%';
3.查询用户
select user,host,authentication_string
from mysql.user
where user='student';
4.修改密码
alter user 'student'@'%' identified by 'NewPass';
5.每小时最大连接数不能超过2个
alter user 'student'@'%' with max_connections_per_hour 2;
6.密码30天过期
alter user 'student'@'%' password expire interval 30 day;
7.密码过期
alter user 'student'@'%' password expire;
设置过期后,登录不错报,登录后执行任何命令提示修改密码?否则不能执行任何命令。
8.查询用户
select * from mysql.user
where user='student'
and host='%'\G
9.删除用户
drop user 'student'@'%';