Last Updated: December 11, 2019
· marcgwilson

Create Postgres database with UTF-8 encoding

Switch to the postgres user:<br>
sudo su postgres<br><br>
Execute the postgres createdb command:<br>
createdb <dbname> --encoding='utf-8' --locale=en_US.utf8 --template=template0;<br><br>
List the databases from psql:<br>
Quit back to the previous user:<br>

1 Response
Add your response

Don't forget to add the name.
Also if you are using the createdb command you are in your commandline so no need for the ;

createdb -E UTF8 -T template0 --locale=en_US.utf8 <name>
over 1 year ago ·