This question already has an answer here:
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.
try this
Hope it will help you.