在MySQL帐户名称中使用句点字符是否可能?我查看了文档并尝试了谷歌搜索,但没有找到令人信服的信息。
是的,这是可能的,但您需要使用引号("
)转义用户名。
例如:
不带引号:
MariaDB [(none)]> create user name.surname;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '.surname' at line 1
带引号:
MariaDB [(none)]> create user "name.surname";
Query OK, 0 rows affected (0.00 sec)
create user "myuser.lastname"