gpt4 book ai didi

mysql - 错误 1064 (42000) 未能授予权限

转载 作者:行者123 更新时间:2023-11-29 16:55:34 24 4
gpt4 key购买 nike

我按照说明向 Rails 授予数据库权限。我使用了以下代码:

GRANT ALL PRIVILEGES ON demo_proejcts_development.* TO'rails_user'@'localhost' IDENTIFIED BY PASSWORD 'password'

demo_proejcts_developments是我创建的数据库,我想向rails_user帐户授予权限

但是它给了我一个错误,

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 'IDENTIFIED BY PASSWORD 'password'' at line 1

我尝试使用 ` 来覆盖项目名称 `demo_projects_development`,但仍然失败。

此外,我尝试通过“alter user”将评论分成两行,但仍然失败。

最佳答案

不能在 GRANT 语句中使用 IDENTIFIED BY。检查mysql文档here

如果您还没有设置rails_user,那么您可以使用

创建
CREATE USER 'rails_user'@'localhost' IDENTIFIED BY 'password';

通过以下声明,您可以授予所有权限

GRANT ALL ON demo_proejcts_development.* TO 'rails_user'@'localhost';

关于mysql - 错误 1064 (42000) 未能授予权限,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52581244/

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