Mysql中密碼過期處理

2021-09-12 09:32:52 字數 924 閱讀 1200

之前在連線mysql庫的過程中遇到了密碼過期的問題,後來在網上看了好多些部落格,處理了下這個問題。在此寫下部落格,為了方便下自己,也為了方便他人。

mysql中密碼過期有兩種情況,注:資料庫版本為5.7:

1、本機安裝的mysql,進入顯示密碼過期。

2.用資料庫工具連線伺服器中mysql,顯示密碼過期。

情況一:本機密碼過期

select host,user,password_expired,password_last_changed from mysql.user;--檢視密碼的情況

注釋:password_expired代表密碼是否過期,為y代表過期,n代表沒有過期

set password=password('***x')--設定新密碼

update mysql.user setpassword_expired='n'where user='root';

--將密碼設定為不過期,即設定password_expired為n

情況二:伺服器密碼過期

這種情況需要修改指定使用者的password。

set password for 'root'@'%' = password('123456');

參考:

MySQL密碼過期

1 用mysql命令列登入mysql的root使用者 2 重新修改root密碼 set password for root localhost password newpass mysql 5.7增加了兩個欄位password last changed password lifetime來完善安全策...

oracle 密碼過期處理

1.cmd資料庫連線資料庫 sqlplus nolog connect sys orcl123 sys使用者密碼 localhost orcl 自己的例項名 as sysdba select from dba profiles where profile default and resource n...

Oracle密碼過期處理

問題 oracle密碼過期導致資料庫無法訪問 解決方案 1.後台以資料庫管理員身份登陸,伺服器中開啟cmd命令,然後輸入 2.檢視使用者對應的proifle檔案,regent為使用者名稱,預設為default select username,profile from dba users where ...