works best so far! only needed to remove some "COLLATE xy" statements with encodings that sqlite doesnt understand. note that you wont need sqlite3 on your server if you want a clone of your mysql database for local development.
–
benzkjiOct 16 '14 at 11:22

Unfortunately didn't work for me. Apart from problems with "PRIMARY KEY" statements mentioned below, many other errors were reported, related to "INSERT" statements and missing tables ("objects").
–
BartoszKPJul 24 at 15:07

I then used an editor to fix the file. When the keys are removed you end up with a CREATE statement that looks like:
CREATE ...
...,
)
That trailing , has to be removed. In vi this expression matches them, ,$\n)

Then you need to change all \' to ''

Then you can do the import:
sqlite3 local.sqlite3 < localdb.txt.1

And that's it. I haven't found a single program that worked for me. I hope this helps someone.

This is a pretty vague question. What I'd say to do is use the database export function available in most DBs. For example in MySQL you can database export and you'll get a SQL file. That SQL file can then be run against any other SQL enabled DB (which includes SQLite).

Not exactly true. Each server has it's own dialect of SQL, and so you will need to pay close attention to that when both exporting and importing. You can for instance limit the SQL to only ANSI compatible language, but you will still have issues converting the user management portion and SQLite is "weakly typed" by default so there may be some issues with constraints.
–
growlfFeb 27 '14 at 1:28

agreed @growlf, there can be slight differences. However, you should be safe on the majority of operations especially if you have a pretty straightforward data table. My guess is that you'd be fine a majority of the time.
–
ScottFeb 27 '14 at 17:05

There is a fantastic, lightweight tool called SQLite Database Browser that allows you to create and edit sqlite databases. I used it to craete databases for Android apps. You can run SQL statements against it to load up the data so if you export the data from a mySQL database you can just import it using this tool. Here's a link: http://sqlitebrowser.sourceforge.net/

It helps you do exactly what you need to do. In fact, I am literally doing this right now. Export your MySQL using mysqldump or phpMyAdmin and then use the above tool to import it into an sqlite database. He asked for "with exporting a MySQL database into a SQLite database" & the tool above will be the second step in doing exactly what you need. To down vote legitimate help is just so wrong. I'm new here and my answer not only addressed the question but is what I am using right now in a real world situation. Don't be so quick to down vote for no reason and discourage people from participating.
–
Aaron RatnerOct 26 '13 at 8:11

1

You left out the actual second (and most important) step, converting all the MySQL-specific parts of the MySQL dump into SQLite-specific or standard syntax.
–
CL.Oct 26 '13 at 8:21

I'm sorry that the answer wasn't up to your standards but answers the question as asked. If he exports the data from MySQL he can import it with the tool I mentioned. I don't see how anything was left out. This is pointless. I answered the question. It works and I use it all the time. You can disagree if you wish but you are just plain wrong.
–
Aaron RatnerOct 26 '13 at 8:25

1

Late, but this tool does not work for this problem. It does not support MySQL-specific syntax (only SQLite syntax). You will have to edit the dump file quite heavily in order for it to be imported successfully.
–
Sverri M. OlsenNov 3 '14 at 9:53