MariaDB 10.6にSET PASSWORD文でパスワードを変更する

環境
Windows 10 64bit
MariaDB 10.6.4

書式
SET PASSWORD FOR ユーザ名@ホスト名 = PASSWORD('新しいパスワード’);

使用例
1.パスワードを変更します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
MariaDB [testdb]> SET PASSWORD FOR arkgame02@localhost = PASSWORD('456@#!');
Query OK, 0 rows affected (0.020 sec)
MariaDB [testdb]> SET PASSWORD FOR arkgame02@localhost = PASSWORD('456@#!'); Query OK, 0 rows affected (0.020 sec)
MariaDB [testdb]> SET PASSWORD FOR arkgame02@localhost = PASSWORD('456@#!');
Query OK, 0 rows affected (0.020 sec)

2.パスワード変更後ユーザは再度ログインします

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
>mysql -u arkgame02 -p
Enter password: ******
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 24
Server version: 10.6.4-MariaDB mariadb.org binary distribution
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
>mysql -u arkgame02 -p Enter password: ****** Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 24 Server version: 10.6.4-MariaDB mariadb.org binary distribution Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]>
>mysql -u arkgame02 -p
Enter password: ******
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 24
Server version: 10.6.4-MariaDB mariadb.org binary distribution

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]>

 

MariaDB

Posted by arkgame