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

后端 未结 6 1328
迷失自我
迷失自我 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:37

    If your postgres installation is new and you haven't populated any databases yet, then you can remove your data directory and re-run the initdb command with the flag to create databases using UTF-8.

    Modify this command to match your postgres installation. The -E flag tells what character encoding should be the default. Other character encodings are listed here.

    /usr/local/pgsql/bin/initdb -E UTF8 -D /usr/local/pgsql/data -U postgres
    

    It should error and tell you that the data directory is not empty. Follow the instructions and remove the directory, then re-run the command. (Or, remove the data directory before you start, but it's always nice to see the instructions for yourself.)

提交回复
热议问题