Please help me with exporting a MySQL database into a SQLite database.
mysql2sqlite.sh mentioned in the top post doesn't cope well with PRIMARY KEY lines, it doesn't write the trailing ) to complete the CREATE statement.
This is what I did. I ran the mysql dump as:
mysqldump --skip-create-options --compatible=ansi --skip-extended-insert --compact --single-transaction -h -u -p > localdb.txt
I then used grep to remove PRIMARY KEY and KEY:
cat localdb.txt | grep -v "PRIMARY KEY' | grep -v KEY > localdb.txt.1
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.