Database Governance Cheat Sheet

PostgreSQL
PostgreSQL
MySQL
MySQL
Mariadb
Mariadb
SQLServer
SQLServer
Create User

CREATE USER <newUser> identified by encrypted password '<safe password>'
CREATE USER 'newUser'@'%' IDENTIFIED BY PASSWORD 'safe password'
CREATE USER 'newUser'@'%' IDENTIFIED BY PASSWORD 'safe password'
CREATE USER newUser WITH PASSWORD 'safe password'
List Users

select usename from pg_catalog.pg_user;
select host, user from mysql.user;
select host, user from mysql.user;
SELECT name FROM sys.database_principals WHERE type_desc = 'SQL_USER' AND default_schema_name = 'dbo'
Drop User

DROP USER IF EXISTS <user name>
Read Table

GRANT SELECT ON TABLE <TABLE NAME> TO <USER NAME>
Read Write Table

GRANT SELECT, INSERT, UPDATE ON TABLE <TABLE NAME> TO <USER NAME>
Table Admin Privileges

GRANT ALL PRIVILEGES ON TABLE <TABLE NAME> TO <USER NAME>

Do you find this cheat sheet useful ? Give feedback using the widget in right bottom corner and we will make the cheat sheet better!