How do I split the output from mysqldump into smaller files?

Posted by lindelof on Stack Overflow See other posts from Stack Overflow or by lindelof
Published on 2008-09-25T12:08:05Z Indexed on 2010/06/16 20:32 UTC
Read the original article Hit count: 135

Filed under:
|

I need to move entire tables from one MySQL database to another. I don't have full access to the second one, only phpMyAdmin access. I can only upload (compressed) sql files smaller than 2MB. But the compressed output from a mysqldump of the first database's tables is larger than 10MB.

Is there a way to split the output from mysqldump into smaller files? I cannot use split(1) since I cannot cat(1) the files back on the remote server.

Or is there another solution I have missed?

Edit

The --extended-insert=FALSE option to mysqldump suggested by the first poster yields a .sql file that can then be split into importable files, provided that split(1) is called with a suitable --lines option. By trial and error I found that bzip2 compresses the .sql files by a factor of 20, so I needed to figure out how many lines of sql code correspond roughly to 40MB.

© Stack Overflow or respective owner

Related posts about mysql

Related posts about migration