Hey, I need a script (or a lil help writing one) that can take a Tarball'ed MySQL database, extract it, and replace it with a current MySQL db.

Does, anyone know of any script that does this, and if not would it be possible to write something of this nature?

I just know a little PHP.