MariaDB 10.6に指定ユーザー名を変更する方法

環境
Windows 10 64bit
MariaDB 10.6.4

書式
RENAME USER ユーザ名@ホスト名 to 新ユーザ名@ホスト名

使用例
1.登録されているユーザーを確認します

MariaDB [(none)]> SELECT user, host FROM mysql.user where user='arkgame02';
+-----------+-----------+
| User      | Host      |
+-----------+-----------+
| arkgame02 | localhost |
+-----------+-----------+
1 row in set (0.001 sec)

2.ユーザー名をarkgame22に変更します

MariaDB [(none)]> RENAME USER arkgame02@localhost to arkgame22@'localhost';
Query OK, 0 rows affected (0.051 sec)

3.変更後ユーザー名を確認します

MariaDB [(none)]> SELECT user, host FROM mysql.user where user='arkgame22';
+-----------+-----------+
| User      | Host      |
+-----------+-----------+
| arkgame22 | localhost |
+-----------+-----------+
1 row in set (0.001 sec)

 

MariaDB

Posted by arkgame