Export Mysql database to Sqlite

Asked

Viewed 1,829 times

3

I usually use a database in the applications I develop locally.

With the mysql whenever I need to work clone the application to another machine, I need to generate a dump bank and import at local base again. I think I could eliminate some unnecessary effort using a base SQLite that would be stored in the repository along with the application files.

Q: How do I convert/export a database Mysql to an archive of Sqlite?

If it can be done prompt of mysql or of linux best.

I believe that converting the database in this way may not be recommended in cases where more than one person is manipulating the database data. But that won’t be a problem in my specific case.

1 answer

3


Try the script mysql2sqlite.sh: https://gist.github.com/esperlu/943776#file-mysql2sqlite-sh

As described in the header, the way to use:

./mysql2sqlite.sh myDbase | sqlite3 database.sqlite

If you have Ruby installed you can do the following, use the package Sequel through that command and then execute it:

  $ gem install sequel
  $ sequel mysql://user:password@host/database -C sqlite://db.sqlite
  • It worked, it generated an error with only one of the tables "no such table: <table>" that I solved manually.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.