天天看點

建立MySQL使用者設定過期後,登入不錯報,登入後執行任何指令提示修改密碼?否則不能執行任何指令。

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'@'%';

繼續閱讀