Mysql账户名中的句点字符

3
在MySQL帐户名称中使用句点字符是否可能?我查看了文档并尝试了谷歌搜索,但没有找到令人信服的信息。

你为什么不试一下看它是否有效呢? - rlanvin
你尝试过创建带有句点的测试账户吗? - Johnv2020
2个回答

4

是的,这是可能的,但您需要使用引号(")转义用户名。

例如:

不带引号:

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)

1
是的,仅当您使用引号时才会出现这种情况,例如。
create user "myuser.lastname"

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接