Skip to content

Instantly share code, notes, and snippets.

@joebordes
Created October 6, 2019 11:23
Show Gist options
  • Save joebordes/d5f0e76c9063236241abe22164929349 to your computer and use it in GitHub Desktop.
Save joebordes/d5f0e76c9063236241abe22164929349 to your computer and use it in GitHub Desktop.
Add MySQL/PGSQL DB user

MYSQL

  • create user 'username'@'localhost' identified by 'user-password';
  • create database dbname;
  • grant all privileges on dbname.* to 'username'@'localhost';
  • flush privileges;

PSQL

  • sudo --login --user postgres
  • psql
  • CREATE DATABASE dbname;
  • CREATE USER username WITH PASSWORD 'user-password';
  • GRANT ALL PRIVILEGES ON DATABASE dbname to username;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment