Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I have MySQL on my server and different SQLite databases on a client. I'm trying to find a way to create the same databases on the server.

Since a SQLite schema is actually a CREATE query, one way would be to write a script that extracts every critical part from the create query and converts them into a corresponding MySQL query, finally concatenate them all.

This seems quite a complex and hard-to-cover-all-situations method. I am wondering if there is any alternatives?

share|improve this question
    
See the answers of the Convert MySQL to SQlite SO question. –  CL. Oct 4 '12 at 6:57
    
@CL. Hi thanks for replying. That you linked is to convert whole db, while I just want to convert sqlite schema to mysql schema. –  Yulong Oct 4 '12 at 13:51
add comment

1 Answer 1

The three main things to change are:

  • Change AUTOINCREMENT to AUTO_INCREMENT
  • Replace double-quotes around database, table and variable names with backticks
  • Delete any lines with “sqlite_sequence” in them

You should then be able to run the SQL file in MySQL. If you encounter any errors, the fix should be apparent from the error message shown.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.