Skip to main content

How to create SQL user with minimal required permissions

Steps to create user for Rocketadmin in MySQL, PostgreSQL and Oracle DB

Written by Nick
Updated over 2 years ago

Follow these steps to create a user with minimal required permissions (INSERT, UPDATE, DELETE, SELECT) in all tables for given database.

For MySQL:

CREATE USER 'testuser'@'localhost' IDENTIFIED BY 'pwd1234'; GRANT INSERT, UPDATE, DELETE, SELECT ON dbname.* TO 'testuser'@'localhost';

Where,

testuser - your username

pwd1234 - your password

dbname - your database name

Please don't use example credentials for your database connection!

You can check if changes where made and applied correctly by running this quote:

SHOW GRANTS FOR 'username'@'localhost';

For PostgreSQL:

CREATE USER testuser WITH PASSWORD 'pwd1234'; GRANT CONNECT ON DATABASE dbname TO testuse GRANT USAGE ON SCHEMA testsch TO testuse GRANT INSERT, UPDATE, DELETE, SELECT ON ALL TABLES IN SCHEMA testsch TO testuser

Where,

testuser - your username

pwd1234 - your password

dbname - your database name

testsch - your scheme name

Please don't use example credentials for your database connection!

For Oracle DB:

First, make sure to connect and log in as SYSTEM account

CREATE USER testuser IDENTIFIED BY pwd1234; GRANT CONNECT TO testuser; GRANT CREATE SESSION TO testuser; GRANT UNLIMITED TABLESPACE TO testuser; GRANT   SELECT,   INSERT,   UPDATE,   DELETE ON   testsch.* TO   testuser;

Where,

testuser - your username

pwd1234 - your password

testsch - your scheme name

Please don't use example credentials for your database connection!

Did this answer your question?