ユーザー名の変更
RENAME USER
は既存のユーザーの名前を変更するために使用されます。
概要
- RenameUserStmt
- UserToUser
- Username
RenameUserStmt ::=
'RENAME' 'USER' UserToUser ( ',' UserToUser )*
UserToUser ::=
Username 'TO' Username
Username ::=
StringName ('@' StringName | singleAtIdentifier)? | 'CURRENT_USER' OptionalBraces
例
CREATE USER 'newuser' IDENTIFIED BY 'mypassword';
Query OK, 1 row affected (0.02 sec)
SHOW GRANTS FOR 'newuser';
+-------------------------------------+
| Grants for newuser@% |
+-------------------------------------+
| GRANT USAGE ON *.* TO 'newuser'@'%' |
+-------------------------------------+
1 row in set (0.00 sec)
RENAME USER 'newuser' TO 'testuser';
Query OK, 0 rows affected (0.08 sec)
SHOW GRANTS FOR 'testuser';
+--------------------------------------+
| Grants for testuser@% |
+--------------------------------------+
| GRANT USAGE ON *.* TO 'testuser'@'%' |
+--------------------------------------+
1 row in set (0.00 sec)
SHOW GRANTS FOR 'newuser';
ERROR 1141 (42000): There is no such grant defined for user 'newuser' on host '%'
MySQL 互換性
RENAME USER
MySQL と完全に互換性があると予想されます。互換性の違いが見つかった場合は、 バグを報告実行できます。