Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

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?

share
    
Re-run sudo dpkg-reconfigure locales but this time select "en_US ISO-8859-1". Re-run locale -a and report back. –  Milen A. Radev Dec 2 '13 at 18:58
    
I tried to re-run locale (the main locale is en_US) and psql, but it says the same message. –  sky_y Dec 3 '13 at 9:05
    
Based on the self-answer, this isn't likely to be of widespread use to others, so I've put it on hold. –  Jack Douglas Dec 6 '13 at 10:22
comments disabled on deleted / locked posts

migration rejected from stackoverflow.com Dec 6 '13 at 10:21

This question came from our site for professional and enthusiast programmers. Votes, comments, and answers are locked due to the question being closed here, but it may be eligible for editing and reopening on the site where it originated.

closed as off-topic by Jack Douglas Dec 6 '13 at 10:21

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Too localized - this could be because your code has a typo, basic error, or is not relevant to most of our audience. Consider revising your question so that it appeals to a broader audience. As it stands, the question is unlikely to help other users (regarding typo questions, see this meta question for background)." – Jack Douglas
If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer

I successfully logged in to PostgreSQL anyway.

fujiwara@luffy:~$ sudo su - postgres
postgres@luffy:~$ psql 
psql (9.1.9)
Type "help" for help.

postgres=#

Thanks.

share
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.