SHOW DATABASES;
CREATE DATABASE IF NOT EXISTS vapor_database
CHARACTER SET utf8
COLLATE utf8_unicode_ci;
CREATE USER 'vapor_username'@'localhost' IDENTIFIED BY 'vapor_password';
GRANT ALL PRIVILEGES ON vapor_database.* TO 'vapor_username'@'localhost';
FLUSH PRIVILEGES;
CREATE USER vapor_username;
ALTER USER vapor_username WITH PASSWORD 'vapor_password';
CREATE DATABASE vapor_database;
GRANT ALL PRIVILEGES ON DATABASE vapor_database TO vapor_username;
\c vapor_database
GRANT ALL ON SCHEMA public TO vapor_username;
Prior to Postgres 15
CREATE USER vapor_username;
CREATE DATABASE vapor_database;
GRANT ALL PRIVILEGES ON DATABASE vapor_database TO vapor_username;
ALTER USER vapor_username WITH PASSWORD 'vapor_password';
use vapor_database
db.createUser({
user: "vapor_username",
pwd: passwordPrompt(), // or cleartext password
roles: [ { role: "readWrite", db: "vapor_database" } ]
})