Last Updated: December 11, 2019
·
42.51K
· 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>
psql<br>
\l<br><br>
Quit back to the previous user:<br>
exit

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 ·