Skip to content

MySQL on development

Banu Hapeloglu Kutlu edited this page Sep 25, 2018 · 1 revision

We are using SQLite for development and test environment and MySQL for production. If you prefer to use MySQL for your development then follow these steps:

  1. If MySQL is not already installed on your machine, follow these instructions: Install MySQL on CentOS 7.

  2. Make sure that your Gemfile has the following replace:
    gem 'mysql2', :group => [:production]

    with

    gem 'mysql2'

    and uncomment:

    gem 'sqlite3', :group => [:development, :test]

  3. To find the path to your MYSQL socket file:

    mysql -u root
    show variables like 'socket';
    

    or

    mysql --socket
    
  4. Edit your database.yml file and update the development config:

    development:
      adapter: mysql2
      encoding: utf8
      pool: 5
      username: YOUR_LOCAL_USERNAME
      password: YOUR_LOCAL_PASSWORD
      socket: PATH_TO_SOCK_FILE
      timeout: 5000
      database: psulcat_dev
    

    Note: Please do not commit this change to the repository!

  5. Beware that you might get a slightly different schema.rb file after running rake db:migrate. You should discard those changes with git checkout -- schema.rb so that you don't accidentally commit them to the repository.

Clone this wiki locally