问题
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?
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.
回答1:
It is two command in Pervasive SQL as well.
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. One thing to note, most PSQL databases do not have security enabled by default and do not require a user to login. 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.
回答2:
It's 2 commands: CREATE USER and GRANT after.
From MySQL 5.0 Reference Manual
Normally, a database administrator first uses CREATE USER to create an account, then GRANT to define its privileges and characteristics. For example:
CREATE USER 'jeffrey'@'localhost' IDENTIFIED BY 'mypass';
GRANT ALL ON db1.* TO 'jeffrey'@'localhost';
Reference
来源:https://stackoverflow.com/questions/6461758/pervasive-sql-grant-syntax