Skip to content

Instantly share code, notes, and snippets.

@jetersen
Created October 24, 2022 08:42
Show Gist options
  • Save jetersen/6d1e9b97890a3d842c79f7534e4f22cf to your computer and use it in GitHub Desktop.
Save jetersen/6d1e9b97890a3d842c79f7534e4f22cf to your computer and use it in GitHub Desktop.
Create user and grant privileges to database
CREATE USER 'user'@'%' IDENTIFIED BY 'password';
GRANT USAGE ON *.* TO 'user_o'@'%';
GRANT EXECUTE, SELECT, SHOW VIEW, ALTER, ALTER ROUTINE, CREATE, CREATE ROUTINE, CREATE TEMPORARY TABLES, CREATE VIEW, DELETE, DROP, EVENT, INDEX, INSERT, REFERENCES, TRIGGER, UPDATE, LOCK TABLES ON `database`.* TO 'user'@'%';
FLUSH PRIVILEGES;
SHOW GRANTS FOR 'user'@'%';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment