script to convert mysql dump sql file into format that can be imported into sqlite3 db

后端 未结 9 2224
说谎
说谎 2020-11-29 03:07

I have an export SQL file containing tables and data from MySQL and I want to import it into a Sqlite 3 DB.

What is the best way to do that?

Just importing t

9条回答
  •  天命终不由人
    2020-11-29 03:43

    To get the above script to work, I made the following changes:

    1. run it with #!/bin/bash
    2. add two seds to the list of pipelined seds:
      • sed 's/\\r\\n/\\n/g'
      • sed 's/\\"/"/g'
    3. the 'rm tmp' line is a no-op (unless you have a file named 'tmp' lying around :O )
    4. my mysqldump command looked like this:

      $ mysqldump -u usernmae -h host --compatible=ansi --skip-opt -p database_name > dump_file

    Then it worked nicely... thanks for the script.

提交回复
热议问题