PDA

View Full Version : backing up MySQL database to a network drive


carelesshx
11-10-2008, 03:35 PM
I need to backup a SQL database to a network folder using the MySQL Administrator tool (using Debian). The path to the network folder is \\server\I$\folder but this doesn't seem to work correctly. Does the network folder have to be mounted somewhere, and if so, how? I cannot navigate to the network using the browse window so can't select the target, so I suspect it would have to be mounted somewhere...

There are other problems involving scheduled backups, but I will some back to them once I have at least one backup ;)

Thanks in advance...

tagnu
11-10-2008, 04:05 PM
How about taking backup first using.

mysqldump -u root -p db-name >sqldump.sql

Mount the network drive.

Copy it to drive.

guelphdad
11-10-2008, 07:00 PM
tagnu, that would restore a backup, not create one. You would use mysqldump to create the backup then restore it as you suggest.

oesxyl
11-10-2008, 07:24 PM
I need to backup a SQL database to a network folder using the MySQL Administrator tool (using Debian). The path to the network folder is \\server\I$\folder but this doesn't seem to work correctly. Does the network folder have to be mounted somewhere, and if so, how? I cannot navigate to the network using the browse window so can't select the target, so I suspect it would have to be mounted somewhere...

There are other problems involving scheduled backups, but I will some back to them once I have at least one backup ;)

Thanks in advance...
as guelphdad said, use mysqldump for backup:

mysqldump -h localhost -u root -p databasename > sql-backup-filename

after you push enter give password and the resulted file is a backup file.
replace localhost, root, databasename and sql-backup-filename with what you want.

to restore backup can do as tagnu said but by database must exists else will fail.
if not exists, do:
mysql -h localhost -u root -p
enter password
> create databasename
> use databasename
> source sql-backup-filename
> quit

see man mysqldump, man mysql.

PS: on linux systems slashes are / not \, so probably is //server/I$/folder, I don't realy understand what you are talking about so I could be wrong.

best regards

tagnu
11-11-2008, 05:33 AM
tagnu, that would restore a backup, not create one. You would use mysqldump to create the backup then restore it as you suggest.



I'm extremely sorry, my apologies. That has to be mysqldump. (updated the thread.)