2

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?

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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