...
Code Block |
---|
sudo -u postgres psql -c 'CREATEcreate DATABASE newid WITH OWNER "postgres" ENCODING "UTF8" LC_COLLATE = "en_US.UTF-8" LC_CTYPE = "en_US.UTF-8" TEMPLATE template0;'database newid;' |
If you want to encode in UTF8, you need to change teamplate0 in UTF8 first
Code Block |
---|
sudo -u postgres psql
update pg_database set datallowconn = TRUE where datname = 'template0';
\c template0
update pg_database set datistemplate = FALSE where datname = 'template1';
drop database template1;
create database template1 with template = template0 encoding = 'UTF8';
update pg_database set datistemplate = TRUE where datname = 'template1';
\c template1
update pg_database set datallowconn = FALSE where datname = 'template0'; |
Code Block |
---|
sudo -u postgres psql -c "create database newid with encoding='utf8' template=template0;" |
Code Block |
---|
CREATE DATABASE "helpspotdb_db"name
OWNER = WITH OWNER "postgres"role_name
TEMPLATE = template
ENCODING = 'UTF8'encoding
LC_COLLATE = collate
LC_COLLATECTYPE = ctype
TABLESPACE = 'en_US.UTF-8'tablespace_name
CONNECTION LIMIT = LC_CTYPE = 'en_US.UTF-8'
TEMPLATE template0;max_concurrent_connection
WITH ENCODING='UTF8' |
Once you create user successfully, you can try to check by
Code Block |
---|
psql -h localhost -U <your_username> |
To see the database list
To see the user list