Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

createdb: too many command line arguments (first is template0)

Tags:

postgresql

I am new to PostgreSQL and I was told to create a database with the following command:

createdb -U $USER --locale=en_US.utf-8 -E utf-8 -O $USER mangodb -T template0

But I get the error "createdb: too many command line arguments (first is template0)". What's wrong with this command?

like image 755
MarcioPorto Avatar asked Jan 27 '26 00:01

MarcioPorto


1 Answers

According to the documentation the database name (and possible description) comes last. So -T template0 has to come before the mangodb database name:

createdb -U $USER --locale=en_US.utf-8 -E utf-8 -T template0 mangodb

The option -T template0 is only required if template1 has an encoding other than utf-8. Otherwise you should probably omit the option such that you would use template1 which tends to be more useful than template0 because it has more extensions loaded and other site-specific data.

Note also that -O $USER is superfluous because of -U $USER: the connected user is the owner of the new database by default.

like image 141
Patrick Avatar answered Jan 28 '26 15:01

Patrick



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!