/ Published in: Bash
Dump a MySQL database to SQLite
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
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
URL: http://forums.mysql.com/read.php?145,68269,92627