MySQL Forums
Forum List  »  SQLite

SQLite Migration - Converter tools: SQlite -> MySQL
Posted by: alexey petrovsky
Date: June 04, 2006 12:44PM

1) Use .schema output to construct valid mysql CREATE TABLE statements. It may be hard to guess your layout of SQLite because it's typeless.

You can have such a schema --

CREATE TABLE yourtable (a,b,c,d,e);

-- so it may be need to analyze structure of the each field and guess it's type for all entries there. It maybe simplier if you have CREATE TABLE with types assigned.

Edit the header file in a separate file.

sqlite> .sch

-- and copy&paste the table declaration into an editor of your preference.

2) Next step is create INSERT statements:

$ sqlite yourdatabase.db
sqlite> .mode insert
sqlite> .output yourdatabase2mysql.sql


$ echo ".dump" | sqlite yourdatabase.db > yourdatabase2mysql.sql

3) Insert your a) header file (see #1), b) yourdatabase2mysql.sql

$ mysql -u user -p password yourdatabase <your_header.sql
$ mysql -u user -p password yourdatabase <yourdatabas2mysql.sql

Hope this helps!

Options: ReplyQuote

Written By
February 06, 2006 12:12PM
SQLite Migration - Converter tools: SQlite -> MySQL
June 04, 2006 12:44PM
June 03, 2009 07:58AM
February 13, 2009 06:29PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.