jana
asked on
What is the best way to backup a database in MySql
We have been working with MySql version 5.0.91 and wanted to know how to make a full backup of a specific database
Do you want the backup to run automatically or manually.
There is always mysqldump - which can be scripted to dump the database regularly.
There is always mysqldump - which can be scripted to dump the database regularly.
ASKER
manually.
You can use the Data Export functionality in Workbench
Other tools like Heidi and SQLYog also have export functionality
The following will do it as well. Remember to prefix with path if mysqldump is not in the path
Other tools like Heidi and SQLYog also have export functionality
The following will do it as well. Remember to prefix with path if mysqldump is not in the path
mysqldump -h server -u username -p databasename > database_dump.sql
Enter password when prompted and you are done.
ASKER
Yup - I would change to a self-contained file though - easier to move around / archive etc
So under Export options just click the bottom radio - self contained file.
So under Export options just click the bottom radio - self contained file.
ASKER
Thanx!
What about "mysqldump", where do we execute it?
What about "mysqldump", where do we execute it?
Mysqldump is run from the command line / terminal
You can also put it in a batch file / shell script and have a scheduler / cron job kick it off.
You can also put it in a batch file / shell script and have a scheduler / cron job kick it off.
1 0 * * * /root/MysqlScripts/MysqlDumpScript.sh
[root@sdc MysqlScripts]# cat MysqlDumpScript.sh
mysqldump -u backup --password=xxxxxx --all-databases --add-locks > /root/MysqlScripts/mysqldump.db
Or you could have this script; set the permissions for the script carefully
#!/bin/sh
Today="`date +%m%d%y%H%M`"
mysqldump -uUserBackup -pYourPassword --all-databases | gzip -cq > /path/to/storage/sqldmp$Today.gz
ASKER
Please excuse our ignorance, how do we get to the command line / terminal; is this CMD or DOS prompt?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanx!!!
You are welcome thanks for the points.
ASKER
The tools we have is Workbench 6.2 and PHPcoder for PHP (just incase PHP is better way to go)