-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Using PostgreSQL instead of MySQL
Erik E. Harmon edited this page Apr 16, 2014
·
14 revisions
This is an addendum to the Novice setup guide so that you can use PostgreSQL in place of MySQL.
This will get you up and going as fast as possible, but in production you shouldn't run your application under the postgres
user. But out of the box it's the user that can run the create scripts on application launch.
sudo apt-get install postgresql-9.1 postgresql-server-dev-9.1
# allow password login
sudo sh -c 'echo "local all postgres md5" >> /etc/postgresql/9.1/main/pg_hba.conf'
# by default postgres user doesn't have one.
sudo -u postgres psql -U postgres -d postgres -c "alter user postgres with password 'yourpassword';"
In the Gemfile
, disable mysql2
and add the pg
gem.
#gem 'mysql2'
gem 'pg'
In the .env
, change the database setup section to the following:
DATABASE_ADAPTER=postgresql
DATABASE_ENCODING=utf8
DATABASE_RECONNECT=true
DATABASE_NAME=huginn_development
DATABASE_POOL=5
DATABASE_USERNAME=postgres
DATABASE_PASSWORD="yourpassword"
DATABASE_HOST="127.0.0.1"
DATABASE_PORT=5432
Everything else should continue as normal.