Wednesday, September 16, 2009

Backing up Mysql Database on a Windows Machine

It took me a  while to get this but if you wish to back up your MySql database ( using mysqldump )  as a scripted/text file it is simple really.

Go to your command prompt (not the mysql command prompt but the DOS command prompt ie Run CMD) and go to the

Programfiles directory where you have mysql installed and go to the bin directory.

It should look something like this

C:\Program Files\MySQL\MySQL Server 5.0\bin>

 

To get here you can just type “cd C:\Program Files\MySQL\MySQL Server 5.0\bin>”
Once here use the following syntax

 

C:\Program Files\MySQL\MySQL Server 5.0\bin>mysqldump -u root –p<your password (no space between the –p and your password)> --opt <databasename> > c:\backupfile.sql

 

This will leave a backupfile named backupfile.sql  on your C:\ drive

For kicks here is a real life example

 

C:\Program Files\MySQL\MySQL Server 5.0\bin>mysqldump -u root –pZoom1A –opt master > c:\temp\master_backup.sql

 

Thanks and if you ever need a weighing system or food processing software or bar code systems call us