Create a new Ruby on Rails application using MySQL instead of SQLite

前端 未结 19 1319
难免孤独
难免孤独 2020-12-04 05:46

I want to create my Rails application with MySQL, because I like it so much. How can I do that in the latest version of Rails instead of the default SQLite?

19条回答
  •  难免孤独
    2020-12-04 06:21

    you first should make sure that MySQL driver is on your system if not run this on your terminal if you are using Ubuntu or any Debian distro

    sudo apt-get install mysql-client libmysqlclient-dev
    

    and add this to your Gemfile

    gem 'mysql2', '~> 0.3.16'
    

    then run in your root directory of the project

    bundle install
    

    after that you can add the mysql config to config/database.yml as the previous answers

提交回复
热议问题