Installation Experiences/Aug 2011: Debian Squeeze: Unable to create database (FIXED)

From Davical
Jump to navigationJump to search

I was recently installing DAViCal on a virtual private server running Debian Squeeze. Following the offical Installation page I wanted to create the database running

# su postgres -c /usr/share/davical/dba/

This, however, didn't work:

# su postgres -c /usr/share/davical/dba/
createdb: database creation failed: ERROR:  encoding UTF8 does not match locale en_US
DETAIL:  The chosen LC_CTYPE setting requires encoding LATIN1.
Unable to create database

Note that there is another article on a similar issue. Unfortunately, this solution did not work for me.

Finally, I was able to track down the error: Postgre's `main' cluster was using LATIN1 as encoding, and this lead to above error. Dropping the cluster and recreating it with the appropriate locales then worked:

# pg_dropcluster --stop 8.4 main
# pg_createcluster --start --locale=en_US.UTF-8 8.4 main

Note: Make sure that you use the enter the correct PostgreSQL version in above commands!

That's it. I was able to create the database afterwards.