Web Hosting Talk







View Full Version : Script to dump the database


WebUser
07-10-2001, 10:36 PM
I have an account at cgi-bin.spaceports.com , and it reachs about 10mb now . I downloaded the database for backup , and now want to dump it in another site that give me 50mb of mysql database (but this site doesn't have telnet). I can't use myphpAdmin to dump it (the database 10mb) to the database of my new account .
So anyone here has any script that allow me to do that job? If yes, please send me a copy. thank you.

allera
07-10-2001, 10:42 PM
From a shell prompt, try running:

mysqldump <database> > my_database.sql

To put it back into mysql on your new host, try:

mysql <database> < my_database.sql

That should work for ya.

slade
07-10-2001, 11:59 PM
You missed the part where he said his new host doesn't have telnet.

I have it now, and would not give it up...


is this database one table? or just a small number of tables?

If you can upload said database through your control panel or ftp to your site, it shouldn't be too hard to re-parse it back in.

If I had a few more years of programming experience behind me, I'd offer to do it myself, but I don't want to risk blowing something up :unhappy:


---- Message is over now, just want to see this icon in use:

:kaioken: Kaioken... Die bad hackers... quit DOS'ing us...

slade
07-11-2001, 12:02 AM
Really, I'm not doing this for the numbers...


Call up your new host and tell them about your dilema... they should be able to either turn telnet on for you for a few days or have one of their techs log in and run that shell command allera posted.

yipeedoo
07-11-2001, 03:33 AM
well i made a php script which can do that and then again put it back... had same problems.... it works fine... but again as slade said i don't want to blow anything for you man... :(

allera
07-11-2001, 07:52 AM
Originally posted by slade
You missed the part where he said his new host doesn't have telnet.
Whoops! Too late at night for me I think. :D

If you still haven't found a solution, you might want to give your new host your db and have him inject it into mysql for you. Either that, or what slade suggested (host gives you telnet/SSH access for a few days).

Either way, good luck. :)

AndyB
07-11-2001, 08:12 AM
Not having telnet access isn't really a big problem in this case, if you've got Perl (or anything else that will do a system call). Write a Perl script with allera's command line like this:

#!/usr/local/bin/perl
`mysqldump <database> > my_database.sql';

You might have to hard-code the path to mysqldump in that command line. You might also need to create an empty file called my_database.sql, upload it, and chmod it so that it's writeable by world. Then make yourself a little html file with a form that does a post to your Perl script. Click submit, it does a system call to dump the database, and you ftp your database backup to your local machine.

I have a home-grown Perl script which emails me a backup of my database every morning. I know this can work for you.

Andy