PDA

View Full Version : MySQL backup



gyrbo
May 12th, 2001, 07:49
I there a script that makes a backup of your db? Like:
- Copies everything to a file and if requested copies it back into the db
- Copies it to an other db
Thanks for nay help

Gonzo
May 12th, 2001, 09:14
You can use phpMyadmin for that.

lucifer
May 13th, 2001, 13:45
MySQL has the following commands


BACKUP TABLE tbl_name[,tbl_name...] TO '/path/to/backup/directory'

RESTORE TABLE tbl_name[,tbl_name...] FROM '/path/to/backup/directory'

look like they maybe what your after see MySQL docs for details. run them from a php script be about 3 lines long

gyrbo
May 14th, 2001, 15:57
Originally posted by lucifer
MySQL has the following commands


BACKUP TABLE tbl_name[,tbl_name...] TO '/path/to/backup/directory'

RESTORE TABLE tbl_name[,tbl_name...] FROM '/path/to/backup/directory'

look like they maybe what your after see MySQL docs for details. run them from a php script be about 3 lines long
Thanks I hope it works. But I dont get the following line:
tbl_name[,tbl_name...] Do they need to be the same?

Gonzo
May 14th, 2001, 16:30
I am guessing that is if you want to backup more then one table. like put
BACKUP TABLE table1 TO '/path/to/backup/directory'
to backup one table, and use
BACKUP TABLE table1, table2 TO '/path/to/backup/directory'
to backup 2 tables

lucifer
May 14th, 2001, 17:35
looks good to me ;)

jw
May 14th, 2001, 19:15
also lookup mysqldump at the mysql site.

Epgs
May 14th, 2001, 21:58
its time to pull out the old floppies

jrap
May 22nd, 2001, 16:10
Here is a quick example using the 'mysqldump' command.

mysqldump -u user -p --opt database| gzip > /home/user/database.contents.gz

Edit and paste that into telnet or SSH. You will be prompted to type the password for 'user' (mysql login).

Hope that helps a little.