Convert MySQL and SQLite

SQLite ----> MySql

  1. Download sqlite3.exe on http://www.sqlite.org
  2. Export the SQLite database with sqlite3.exe and command parameter ".dump" (Nate, ".export" doesn't exist!), an example :
    sqlite3 mySQLiteDataBase .dump .quit >> myDumpSQLite
  3. Adapt the dump to get it compatible for MySQL
    - Replace " (double-quotes) with ` (grave accent)
    - Remove "BEGIN TRANSACTION;" "COMMIT;", and lines related to "sqlite_sequence"
    - Replace "autoincrement" with "auto_increment"
  4. The dump is ready to get imported in a MySQL server

MySql ----> SQLite

  1. Export the database in an ASCII compatible format. (functionnality available in phpMyAdmin 2.6.1)
  2. Import to SQLite with command line : sqlite3 mySQLiteDataBase < dumpMySQL

1 komentar: Leave Your Comments