创建新的数据库
1 2 3 |
psql -U postgres -c "CREATE DATABASE $DB_NAME;" |
创建新的用户
1 2 3 |
psql -U postgres -c "CREATE USER $DB_USER WITH PASSWORD '$DB_PASSWORD';" |
将新数据库的所有权限授予新用户
1 2 3 |
psql -U postgres -c "GRANT ALL PRIVILEGES ON DATABASE $DB_NAME TO $DB_USER;" |
删除数据库
1 2 3 |
psql -U postgres -c "DROP DATABASE IF EXISTS $DB_NAME;" |
删除用户
1 2 3 |
psql -U postgres -c "DROP USER IF EXISTS $DB_USER;" |
-EOF-