0

I am working on a project in Rails 4. I was using sqlite3 database previously. But now I want to switch the database from sqlite3 to mysql. But all my previous application data should be copied so when I use mysql database none of my table data may be deleted.

ccy
  • 1,735
  • 16
  • 19
Mahesh Sharma
  • 221
  • 1
  • 13

1 Answers1

1

try this

1. cd /path/to/rails_app/db

2. sqlite3 DATA-BASE-NAME .dump > database.sql

3. mysql -u username -p -h localhost DATA-BASE-NAME < database.sql

Hope it will help you.

Hardik Upadhyay
  • 2,639
  • 1
  • 19
  • 34
  • ok i will try it and update............thanks.......... :) – Mahesh Sharma Mar 27 '17 at 05:56
  • i am successful in changing my database...but some another method....but now i am facing issue in one of my file using strftime query.......i have posted one question.......rply in that if you know..........http://stackoverflow.com/questions/43061570/strftime-error-while-switching-my-database-from-sqlite3-to-mysql-in-rails4 – Mahesh Sharma Mar 28 '17 at 05:58
  • @Hardik...........................thanks........ :) – Mahesh Sharma Mar 28 '17 at 05:59
  • i have upvoted you....you also upvote me in all my questions....!!! – Mahesh Sharma Apr 04 '17 at 09:56