MySQL 允许用户创建和更改表?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7113789/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Allow user to create and alter table?
提问by Jonah Katz
I have a current mysql user who has SELECT
privileges for all the table in database example
. How can give that user privileges to add new tables, and alter/add records to the table it created?
我有一个当前的 mysql 用户,他拥有SELECT
数据库中所有表的权限example
。如何授予该用户添加新表的权限,并将记录更改/添加到它创建的表中?
回答by Jrod
Use the grant keyword combined with the table privileges you seek to give the user.
将 grant 关键字与您寻求授予用户的表权限结合使用。
GRANT ALTER, CREATE ON example TO 'someuser'@'somehost';
回答by Cydonia7
GRANT SELECT, INSERT, DELETE ON database TO username@'localhost' IDENTIFIED BY 'password';
GRANT SELECT, INSERT, DELETE ON database TO username@'localhost' IDENTIFIED BY 'password';
You can use UPDATE in the list too.
您也可以在列表中使用 UPDATE。
回答by Cydonia7
maybe something like
也许像
GRANT ALL PRIVILEGES ON example
. * TO 'user'@'%';
授予所有特权example
。* TO '用户'@'%';
This gives all the privileges for ONLY the 'example' database to user
这仅将“示例”数据库的所有权限授予用户
回答by 83r110
Old; but just because it comes first when you query about "mysql grants to create table"
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER, LOCK TABLES, SHOW VIEW ON database
.* TO 'user'@'host'
老的; 但仅仅因为当您查询“mysql grants to create table”时它首先出现 GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER, LOCK TABLES, SHOW VIEW ON database
.* TO 'user'@'host'