Return to Snippet

Revision: 45411
at April 29, 2011 17:30 by jmiller


Initial Code
mysqldump --compact --compatible=ansi --default-character-set=binary mydbname | 
grep -v ' KEY "' | 
grep -v ' UNIQUE KEY "' | 
perl -e 'local $/;$_=<>;s/,\n\)/\n\)/gs;print "begin;\n";print;print "commit;\n"' | 
perl -pe ' 
if (/^(INSERT.+?)\(/) { 
$a=$1; 
s/\\'\''/'\'\''/g; 
s/\\n/\n/g; 
s/\),\(/\);\n$a\(/g; 
} 
' | 
sqlite3 sqlite.db

Initial URL
http://forums.mysql.com/read.php?145,68269,92627

Initial Description
Dump a MySQL database to SQLite

Initial Title
MySQL to SQLite

Initial Tags


Initial Language
Bash