MYSQL中语法错误的原因未知(Unknown reason for syntax error in MYSQL)

编程入门 行业动态 更新时间:2024-10-28 09:26:22
MYSQL中语法错误的原因未知(Unknown reason for syntax error in MYSQL)

错误消息指出“SQL语法错误NEAR'表,alter table,...”没有错误号码

CREATE USER admin@localhost IDENTIFIED BY 'password'; GRANT select, update, insert, delete, create table, alter table, drop table, create index, drop index, create routine, create procedure, create function ON test.* TO admin@localhost;*

我试图授予的所有项目都是有效的权限,但当它到达列表中的第一个“表”时,它只是不喜欢它,我错过了什么或者是否存在我不理解的冲突。

TIA

Error message states "SQL syntax error NEAR 'table, alter table,..." NO ERROR NUMBER GIVEN

CREATE USER admin@localhost IDENTIFIED BY 'password'; GRANT select, update, insert, delete, create table, alter table, drop table, create index, drop index, create routine, create procedure, create function ON test.* TO admin@localhost;*

All of the items I am trying to grant are valid permissions but when it gets to the first "table" in the list it just does not like it, am I missing something or is there a conflict that I just don't understand.

TIA

最满意答案

不需要table :

GRANT select, update, insert, delete, create, alter, drop ON test.* TO admin@localhost;

我不确定如何添加程序,功能权限,我会找到它。

如fvu所述,你可以找到授权权限MySQL手册。 特别是对于PROCEDURE, http://dev.mysql.com/doc/refman/5.5/en/grant.html#grant-routine-privileges

更新

我已经阅读了你对你的问题的评论。 output is from SHOW GRANTS ... 我用谷歌搜索了它。 SHOW GRANTS的输出看起来可以直接在MySQL中运行。 但它不能。 (这个事实我只是不知道。谢谢)

以及如何找到你想要的东西......你能试试吗?:

SELECT * FROM information_schema.USER_PRIVILEGES WHERE GRANTEE = 'user_id@hosname';

你可以看到user @ hostname有哪些真正的权限...好。 但很难制作GRANT ... Percona有这样一个有趣的功能:

SELECT sql_grants FROM common_schema.sql_show_grants;

我发现了这个问题 。

非常感谢! 我已经为你的问题学到了很多技巧!

table is not needed:

GRANT select, update, insert, delete, create, alter, drop ON test.* TO admin@localhost;

I'm not sure about that how to add procedure, function privileges, I'll find it.

as fvu mentioned, you can find grant privileges MySQL Manual. especially for PROCEDURE, http://dev.mysql.com/doc/refman/5.5/en/grant.html#grant-routine-privileges

UPDATED

I have read your comment on your question. output is from SHOW GRANTS .... I have googled about it. output of SHOW GRANTS looks like that can run directly in MySQL. but it can't. (this fact I just didn't know. thanks)

and how to find something like you want... can you try this?:

SELECT * FROM information_schema.USER_PRIVILEGES WHERE GRANTEE = 'user_id@hosname';

You can see which real privileges name user@hostname has... good. but hard to make GRANT ... Percona has interesting feature like this:

SELECT sql_grants FROM common_schema.sql_show_grants;

I found it this question.

Thanks alot! I have learned many skills for your question!!!

更多推荐

本文发布于:2023-08-07 03:59:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1461157.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:语法错误   原因   MYSQL   Unknown   error

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!