3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

MySQL8.0でのユーザー作成について ERROR 1819 (HY000): が出たとき

Posted at

MySQL8.0にユーザーを追加しようとしたところエラーが出ました

ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

このエラーはもっと文字列を複雑にしてくださいという内容です。

これではユーザー作成できないので、どんな制限がかかっているかみてみました。

SHOW VARIABLES LIKE 'validate_password%';
+--------------------------------------+--------+
| Variable_name                        | Value  |
+--------------------------------------+--------+
| validate_password.check_user_name    | ON     |
| validate_password.dictionary_file    |        |
| validate_password.length             | 8      |
| validate_password.mixed_case_count   | 1      |
| validate_password.number_count       | 1      |
| validate_password.policy             | MEDIUM |
| validate_password.special_char_count | 1      |
+--------------------------------------+--------+

パスワードの長さは8文字以上、ポリシーは MEDIUM になっていてこれだと簡単な物だとエラーが出てしまいます。
なので以下のように設定しました。

mysql> set global validate_password_length=6; # 文字列の長さを変更
mysql> set global validate_password_policy=LOW; # ポリシーを変更
mysql> set global validate_password.check_user_name = OFF; 
+--------------------------------------+-------+
| Variable_name                        | Value |
+--------------------------------------+-------+
| validate_password.check_user_name    | OFF   |
| validate_password.dictionary_file    |       |
| validate_password.length             | 6     |
| validate_password.mixed_case_count   | 1     |
| validate_password.number_count       | 1     |
| validate_password.policy             | LOW   |
| validate_password.special_char_count | 1     |
+--------------------------------------+-------+
7 rows in set (0.00 sec)

行った内容は、パスワードの長さを6文字、ポリシーをLOWに変更

ここでやっと準備が終わったのでユーザー作成へ!

CREATE USER 'test'@'localhost' IDENTIFIED BY 'test'; #ユーザー作成する
SELECT  host, user FROM mysql.user;  #ユーザ作成できているか確認

+-----------+------------------+
| host      | user             |
+-----------+------------------+
| localhost | mysql.infoschema |
| localhost | mysql.session    |
| localhost | mysql.sys        |
| localhost | root             |
| localhost | test             |
+-----------+------------------+
5 rows in set (0.00 sec)

ユーザー追加できました。

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?