mysql湧現ERROR 1819 (HY000)的處理辦法。本站提示廣大學習愛好者:(mysql湧現ERROR 1819 (HY000)的處理辦法)文章只能為提供參考,不一定能成為您想要的結果。以下是mysql湧現ERROR 1819 (HY000)的處理辦法正文
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements,湧現這個成績怎樣辦?不消焦急,上面給出謎底。
為了增強平安性,MySQL5.7為root用戶隨機生成了一個暗碼,在error log中,關於error log的地位,假如裝置的是RPM包,則默許是/var/log/mysqld.log。
普通可經由過程log_error設置
mysql> select @@log_error; +---------------------+ | @@log_error | +---------------------+ | /var/log/mysqld.log | +---------------------+ 1 row in set (0.00 sec)
可經由過程# grep "password" /var/log/mysqld.log 敕令獲得MySQL的暫時暗碼
2016-01-19T05:16:36.218234Z 1 [Note] A temporary password is generated for root@localhost: waQ,qR%be2(5
用該暗碼登錄到辦事端後,必需立時修正暗碼,否則會報以下毛病:
mysql> select user(); ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
假如只是修正為一個簡略的暗碼,會報以下毛病:
mysql> ALTER USER USER() IDENTIFIED BY '12345678'; ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
這個其實與validate_password_policy的值有關。
validate_password_policy有以下取值:
默許是1,即MEDIUM,所以剛開端設置的暗碼必需相符長度,且必需含稀有字,小寫或年夜寫字母,特別字符。
有時刻,只是為了本身測試,不想暗碼設置得那末龐雜,比方說,我只想設置root的暗碼為123456。
必需修正兩個全局參數:
起首,修正validate_password_policy參數的值
mysql> set global validate_password_policy=0; Query OK, 0 rows affected (0.00 sec)
如許,斷定暗碼的尺度就基於暗碼的長度了。這個由validate_password_length參數來決議。
mysql> select @@validate_password_length; +----------------------------+ | @@validate_password_length | +----------------------------+ | 8 | +----------------------------+ 1 row in set (0.00 sec)
validate_password_length參數默許為8,它有最小值的限制,最小值為:
validate_password_number_count + validate_password_special_char_count + (2 * validate_password_mixed_case_count)
個中,validate_password_number_count指定了暗碼中數據的長度,validate_password_special_char_count指定了暗碼中特別字符的長度,validate_password_mixed_case_count指定了暗碼中年夜小字母的長度。
這些參數,默許值均為1,所以validate_password_length最小值為4,假如你顯性指定validate_password_length的值小於4,雖然不會報錯,但validate_password_length的值將設為4。以下所示:
mysql> select @@validate_password_length; +----------------------------+ | @@validate_password_length | +----------------------------+ | 8 | +----------------------------+ 1 row in set (0.00 sec) mysql> set global validate_password_length=1; Query OK, 0 rows affected (0.00 sec) mysql> select @@validate_password_length; +----------------------------+ | @@validate_password_length | +----------------------------+ | 4 | +----------------------------+ 1 row in set (0.00 sec)
假如修正了validate_password_number_count,validate_password_special_char_count,validate_password_mixed_case_count中任何一個值,則validate_password_length將停止靜態修正。
mysql> select @@validate_password_length; +----------------------------+ | @@validate_password_length | +----------------------------+ | 4 | +----------------------------+ 1 row in set (0.00 sec) mysql> select @@validate_password_mixed_case_count; +--------------------------------------+ | @@validate_password_mixed_case_count | +--------------------------------------+ | 1 | +--------------------------------------+ 1 row in set (0.00 sec) mysql> set global validate_password_mixed_case_count=2; Query OK, 0 rows affected (0.00 sec) mysql> select @@validate_password_mixed_case_count; +--------------------------------------+ | @@validate_password_mixed_case_count | +--------------------------------------+ | 2 | +--------------------------------------+ 1 row in set (0.00 sec) mysql> select @@validate_password_length; +----------------------------+ | @@validate_password_length | +----------------------------+ | 6 | +----------------------------+ 1 row in set (0.00 sec)
固然,條件是validate_password插件必需曾經裝置,MySQL5.7是默許裝置的。
那末若何驗證validate_password插件能否裝置呢?可經由過程檢查以下參數,假如沒有裝置,則輸入將為空。
mysql> SHOW VARIABLES LIKE 'validate_password%'; +--------------------------------------+-------+ | Variable_name | Value | +--------------------------------------+-------+ | validate_password_dictionary_file | | | validate_password_length | 6 | | validate_password_mixed_case_count | 2 | | validate_password_number_count | 1 | | validate_password_policy | LOW | | validate_password_special_char_count | 1 | +--------------------------------------+-------+ 6 rows in set (0.00 sec)
以上就是本文的全體內容,願望對年夜家的進修有所贊助,也願望年夜家多多支撐。