2 Mar 2009, 5:55am
/dev/ruby
by chris

Comments Off

mysql2sqlite.rb

Introducing mysql2sqlite.rb, a Ruby script for converting MySQL databases into Sqlite databases.

Based on my googling of the web, I figure I’m one of perhaps five people in the world who’ve ever wanted to do this conversion but in case you’re number six, here you go.

Usage is pretty straight-forward. It can either be configured via command-line parameters or via a specified YAML file:

./mysql2sqlite.rb database_name database_user database_password
./mysql2sqlite.rb config.yaml

and it will spit out two files: one of the raw, converted SQL and one that is the Sqlite database. For instance, if your MySQL database was called ‘clients’ you’d end up with clients.sql and clients.sqlite.

For more details and source code see the mysql2sqlite.rb project on github.