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

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

    Use following command to create new app for API with mysql database

    rails new  --api -d mysql
    
    
      adapter: mysql2
      encoding: utf8
      pool: 5
      username: root
      password: 
      socket: /var/run/mysqld/mysqld.sock
    

提交回复
热议问题