gpt4 book ai didi

python - 错误 1064 (4200) - 当我在 MySQL 中输入 GRANT ALL 请求时

转载 作者:行者123 更新时间:2023-11-29 02:45:52 24 4
gpt4 key购买 nike

GRANT ALL ON uesrName.* TO username@hostname.mysql.pythonanywhere-services.com;

错误 1064 (42000):您的 SQL 语法有误;查看与您的 MySQL 服务器版本对应的手册,了解在 '-services.co 附近使用的正确语法m' 在第 1 行

谁能告诉我,是不是“-”导致我的请求失败。

我使用了 pythonanwhere.com 提供的正确用户名和主机名执行此任务时,我使用的是 pythonanywhere.coms GUI。

最佳答案

Several objects within GRANT statements are subject to quoting, although quoting is optional in many cases: Account, database, table, column, and routine names. For example, if a user_name or host_name value in an account name is legal as an unquoted identifier, you need not quote it. However, quotation marks are necessary to specify a user_name string containing special characters (such as -), or a host_name string containing special characters or wildcard characters (such as %); for example, 'test-user'@'%.com'. Quote the user name and host name separately.

您必须将主机名引用为

username@'hostname.mysql.pythonanywhere-services.com'

没有引用:

mysql> GRANT ALL ON uesrName.* TO username@hostname.mysql.pythonanywhere-services.com;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-services.com' at line 1

引用:

mysql> GRANT ALL ON uesrName.* TO username@'hostname.mysql.pythonanywhere-services.com';
Query OK, 0 rows affected (0.00 sec)

关于python - 错误 1064 (4200) - 当我在 MySQL 中输入 GRANT ALL 请求时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42261677/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com