Mysql直接导入sqlite是会发生格式错误的,需要对一些符号进行转换。
Shell脚本:
#!/bin/sh
mysqldump --opt --no-create-db --no-create-info --default-character-set=utf8 --extended-insert=0 -uuser -ppassword database \
| grep 'INSERT' \
| sed -e "s/\\\'/''/g" -e "s/\\\r/\r/g" -e "s/\\\n/\n/g" -e 's/\\\"/"/g' > backup.sql