Skip to content

Instantly share code, notes, and snippets.

@caffeinetiger
Last active April 18, 2022 18:30
Show Gist options
  • Save caffeinetiger/b18e54b4d89393612b3f974ebc5948f2 to your computer and use it in GitHub Desktop.
Save caffeinetiger/b18e54b4d89393612b3f974ebc5948f2 to your computer and use it in GitHub Desktop.
Snippetse to help create/alter(update) a user in MySQL and grant permissions.
-- Create User
CREATE USER 'username'@'%' IDENTIFIED BY 'somepassword';
-- Update User
ALTER USER 'username'@'%' IDENTIFIED BY 'somepassword';
-- Grant to Specific Schema/DB
GRANT ALL ON some-schema.* TO 'username'@'%';
-- Grant user permissions similiar to master user in RDS
GRANT ALL PRIVILEGES ON `%`.* TO 'username'@'%' WITH GRANT OPTION;
GRANT LOAD FROM S3 ON *.* TO 'username'@'%';
GRANT SELECT INTO S3 ON *.* TO 'username'@'%';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment