PG::Error: ERROR: new encoding (UTF8) is incompatible

后端 未结 6 1342
迷失自我
迷失自我 2021-01-29 19:16

I have installed postgresql-9.2.4 from the source, now in rails app when I execute:

rake db:create command I get:

$ bin/rake db         


        
6条回答
  •  逝去的感伤
    2021-01-29 19:17

    If you use Debian, when you install the postgresql package it will use your default locale to create the template1 database. If you have not configured your OS to use UTF-8 as a default locale, you will encounter this error.

    In addition to the above solutions, if you are on a new installation and have no active databases, you can remove the postgresql package and set your default locale to UTF-8. The advantage of this method is you can omit locale information when creating databases in the future.

    dpkg-reconfigure locales

    If you don't see the desired locale, install the locales-all package

    apt-get install locales-all

    Then remove postgresql

    apt-get remove --purge postgresql-

    Then reinstall or better yet upgrade to a recent release that isn't in Debian stable.

提交回复
热议问题