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

前端 未结 19 1296
难免孤独
难免孤独 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:20

    rails new  -d mysql
    

    OR

    rails new projectname
    

    Changes in config/database.yml

    development:
      adapter: mysql2
      database: db_name_name
      username: root
      password:
      host: localhost
      socket: /tmp/mysql.sock
    

提交回复
热议问题