I'd like to log in to PostgreSQL in my server to change my root (postgres) password .
- Debian GNU/Linux 7.1 wheezy
- PostgreSQL 9.1
After changing below:
$ sudo vi /etc/postgresql/9.1/main/pg_hba.conf
------------------------------------------------
# local all all md5
local all all trust
------------------------------------------------
I tried to log in but I got an error below:
$ sudo psql -h localhost -U postgres
psql: FATAL: database locale is incompatible with operating system
DETAIL: The database was initialized with LC_COLLATE "en_US", which is not recognized by setlocale().
HINT: Recreate the database with another locale or install the missing locale.
As it said, I checked the log:
$ sudo tail -n 30 /var/log/postgresql/postgresql-9.1-main.log
2013-12-02 11:14:15 JST FATAL: database locale is incompatible with operating system
2013-12-02 11:14:15 JST DETAIL: The database was initialized with LC_COLLATE "en_US", which is not recognized by setlocale().
2013-12-02 11:14:15 JST HINT: Recreate the database with another locale or install the missing locale.
2013-12-02 11:14:45 JST FATAL: database locale is incompatible with operating system
2013-12-02 11:14:45 JST DETAIL: The database was initialized with LC_COLLATE "en_US", which is not recognized by setlocale().
2013-12-02 11:14:45 JST HINT: Recreate the database with another locale or install the missing locale.
2013-12-02 11:15:15 JST FATAL: database locale is incompatible with operating system
2013-12-02 11:15:15 JST DETAIL: The database was initialized with LC_COLLATE "en_US", which is not recognized by setlocale().
2013-12-02 11:15:15 JST HINT: Recreate the database with another locale or install the missing locale.
...
I also checked environment variables:
$ echo $LANG
en_US.UTF-8
$ echo $LANGUAGE
en_US.UTF-8
$ echo $LS_COLLATE
(null)
I tried to generate the locale:
$ sudo dpkg-reconfigure locales
$ locale -a
C
C.UTF-8
en_US.utf8
ja_JP.utf8
POSIX
But I couldn't fix it.
How could I fix it? Or how do I recreate the database?
sudo dpkg-reconfigure locales
but this time select "en_US ISO-8859-1". Re-runlocale -a
and report back. – Milen A. Radev Dec 2 '13 at 18:58