SQL Notes

From brainsik
Jump to navigation Jump to search

Postgres

Change a user password

postgres=# alter user USERNAME with password 'PASSWORD' ;

MySQL

Granting privileges

Two examples which show a few different things.

grant all on db.* to 'user'@'host' indentified by 'PASSWORD';
grant some_privelege,another_privielge on db.table to 'user'@'host';

Escaping

Use backticks. Example:

grant all on `db-name-with-dashes`.* to 'user'@'localhost' ;