views:

26

answers:

2

I have a 250 MB backup SQL file but the limit on the new hosting is only 100 MB ...

Is there a program that let's you split an SQL file into multiple SQL files?

A: 

It's not pretty (because it just splits on size, not on what is logically in the file) but you can use the unix split tool to accomplish this:

mysqldump mydb | split -b 100m mydbbackup

Make sure to check the man page for split, your copy may or may not accept the 100m size argument. Some need to have the size specified in bytes.

When you go to restore from the file you'll have to use cat to join them all back together.

cat mydbbackup.1 mydbbackup.2 mydbbackup.3 | mysql
speshak
Sorry, this is not what I'm talking about. All I have is the 250 MB file and the old database no longer exists on the old host. We have a new host and the limit is 100 MB so I need multiple smaller files and create them just from the one 250 MB file ... can't do anything with mysqldump right now ... unless I import it locally where there are no restrictions then do a mysqldump ... but cat'ing won't work.
Brian T Hannan
A: 

I think this thread should answer your question:

http://stackoverflow.com/questions/132902/how-do-i-split-the-output-from-mysqldump-into-smaller-files

birryree