Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

large sqlite database to mysql

Tags:

sqlite

mysql

I have 3 sqlite3 database files, from 170G to 1.07T on my CentOS 7 sever. I can create dump files by sqlite3 logs.db .dump > logs.sql but these sql files can't be imported to MySQL because of syntax.

I've read these solutions:

Quick easy way to migrate SQLite3 to MySQL?

http://www.sqlite.org/cvstrac/wiki?p=ConverterTools

http://www.redmine.org/boards/2/topics/12793

https://realpython.com/blog/python/web2py-migrating-from-sqlite-to-mysql/

https://github.com/athlite/sqlite3-to-mysql

I tried some of them but it seems not working. I don't have enough memory for the string searching and replacement.

Is there some effective way for large sqlite databases to be migrated?

like image 267
leoce Avatar asked Feb 26 '26 11:02

leoce


1 Answers

Apparently I didn't use all the scripts in http://www.redmine.org/boards/2/topics/12793, I only used the latest script by Peter sørensen and it can't handle big files as the console returned "Killed". I guess it has something to do with the temp file operation.

My problem was solved by Pavel Medvedev's script. Although Peter's post says that the updated script deals with "a problem where not all was converted to the correct mysql value when a sting stretched across multiply lines". My sql files have multiple lines of string and Pavel's script can handle it. There's no problem. Maybe the problem Peter mentioned would occur with someone's files.

like image 66
leoce Avatar answered Feb 28 '26 05:02

leoce