Tool to extract single database from a SQL dump file?

I’m trying to move a Wordpress web site from one host to another. The hard part is that I don’t have access to the original site, and the person who created the site is being a pain. I needed the database of the site, and he sent me the localhost.sql - 30 megs of unrelated crap. So it exceeds the 7 meg limit of the MySQL web tools, and none of the text tools I’ve found have worked.

Any suggestions for a tool, preferably on Windows, that will allow me to load in this 30 meg file and extract the one database I need?

Is there anything wrong with:


mysql -uuser -ppassword dbname < localhost.sql

Yeah, didn’t work. Kept getting an empty file.

The situation is made more difficult by the fact that this is on Dreamhost, and the MySQL server is on a different machine.

You could install a copy of MySQL Server (it’s a free download) on your local Windows machine, load the full dump, and then dump out just the database you want.

sed didn’t work either.

I’ve been attempting to you the instructions here, and I get a zero byte target file.

MySQL keeps giving me ERROR 1044 (42000):

Amusingly obscure the first few hundred times, after that you start getting annoyed.

So, any solutions that do NOT involve MySQL?

Dreamhost won’t allow you to run the commands in your sql file. Easiest bet would be to take andrewm’s advice and load the data into an MySQL server running on your local machine and then export exactly what you want for Dreamhost.

I installed the hateful thing on my computer, and am trying to puzzle out the syntax. As usual for Unix style utilities, the “help” file exists solely as a reminder for the person who wrote the program.

For a one-off job, you can split a mysql dump file up with any decent text editor. The division between the tables ought to be plain enough.

Also, the phpmysql Import feature will accept a compressed file. It’s unlikely a 30mb file would compress to 7, but worth a try.

For future reference, WordPress has an export feature.