简体   繁体   English

普遍的SQL GRANT语法

[英]Pervasive SQL GRANT syntax

I've been Googling for half an hour now, and can't seem to find the right place... 我已经去谷歌搜索了一个半小时,似乎找不到合适的地方...

How do I add a user and grant that user access to all tables in the database? 如何添加用户并授予该用户访问数据库中所有表的权限? Found some GRANT snippets, but there is no mentioning of a password, so I assume that can be done on existing users only... But what about adding that user, and password identification? 找到了一些GRANT片段,但没有提及密码,因此我认为只能在现有用户上执行...但是添加该用户和密码标识又如何呢?

PS: Not sure if it belongs more here, or on serverfault (neither has this answer already)... So feel free to move it, if it should be on serverfault instead. PS:不确定它是否在这里,还是在serverfault上(都没有这个答案)...因此,如果它应该在serverfault上,则可以随意移动它。

It is two command in Pervasive SQL as well. 这也是Pervasive SQL中的两个命令。

CREATE USER jsmith WITH PASSWORD password

GRANT SELECT ON * TO jsmith

Full documentation on both are in the SQL Syntax Reference guide on Pervasive's site. 两者的完整文档在Pervasive网站上的《 SQL语法参考指南》中。 One thing to note, most PSQL databases do not have security enabled by default and do not require a user to login. 需要注意的一件事是,大多数PSQL数据库默认情况下未启用安全性,并且不需要用户登录。 The CREATE USER and GRANT statements will return an error if you try to run them on a database that does not have security enabled. 如果您尝试在未启用安全性的数据库上运行CREATE USER和GRANT语句,则会返回错误。

It's 2 commands: CREATE USER and GRANT after. 它是2个命令:CREATE USER和GRANT之后。

From MySQL 5.0 Reference Manual 从MySQL 5.0参考手册

Normally, a database administrator first uses CREATE USER to create an account, then GRANT to define its privileges and characteristics. 通常,数据库管理员首先使用CREATE USER创建一个帐户,然后使用GRANT定义其特权和特征。 For example: 例如:

CREATE USER 'jeffrey'@'localhost' IDENTIFIED BY 'mypass';
GRANT ALL ON db1.* TO 'jeffrey'@'localhost';

Reference 参考

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM