How To Create a mysqldump File
Back up your MySQL database with the mysqldump utility on a Windows machine.
by
Doug
Updated January 29, 2009
MySQL has several ways to create backups of important data. In this article, I will show you how to create a backup of your MySQL database on a Windows machine using the mysqldump utility that is included with MySQL.
- Bring up the Command Prompt (from Start > All Programs > Accessories > Command Prompt)
- Now change the directory to where mysqldump.exe is located. To do this type the following if you using MySQL 5.0: cd C:\Program Files\MySQL\MySQL Server 5.0\bin
- Then hit Enter.
- Now type the following command: mysqldump -u root --password=yourpassword databasename > c:/databasename.sql
- Now go to the c: drive and locate the sql script file that you just created. Keep in mind, that if your database is large, it may take a while to complete the backup.
Example of Step 4 explained:
mysqldump -u admin --password=mypass123 bigdaddy > c:/bigdaddy.sql
The line above is instructing mysql to use the Username: admin with the Password: mypass123 to log into the database named: bigdaddy, and create the mysqldump file in the c:/ directory with the name: bigdaddy.sql
* Note make sure there isn't already a SQL file by the same name in the directory you are dumping the file to.