1

I have an older Rails 3 app that use SQLite3 database. I need to switch it to MySQL - that's kind of easy-peasy.

The problem is that in the SQLite3 database is a scheme of categories - about 500. I need to export these categories from SQLite3 database and import them into the newly create MySQL one.

Now the thing is (as I haven't done it before) - how to make this kind of migration in its simplest way?

user984621
  • 46,344
  • 73
  • 224
  • 412
  • http://stackoverflow.com/questions/18671/quick-easy-way-to-migrate-sqlite3-to-mysql is nice answer, nothing to say more. – nsave Jul 26 '14 at 16:07

1 Answers1

1

sqlite3 dump file is alike mysql one so:

  1. open sqlite3 and run :

    .output filename.sql

    .dump

    .exit

  2. open filename.sql and:

    delete PRAGMA commands

    add 1st line SET foreign_key_checks = 0;

    add last line SET foreign_key_checks = 1;

  3. run in your OS:

    mysql -u<user> -p<user> <database> < filename.sql

Vladimir Chervanev
  • 1,574
  • 1
  • 12
  • 14