PHP / MySQL

  1. Home
  2. Computing & Technology
  3. PHP / MySQL

Backup and Restore MySQL Databases

By Angela Bradley, About.com

1 of 4

Backup Database From the Command Prompt

It is a good idea to backup your MySQL data occasionally as a precautionary measure. It is also a good idea to create a backup before making any major changes, incase something goes wrong and you need to revert to the unmodified version. Database backups can also be used to transfer your database from one server to another if you change web hosts.

From a command prompt, you can backup your entire database using this line:

mysqldump -u user_name -p your_password database_name > File_name.sql

Example:
Let's assume that:
Username: bobbyjoe
Password: happy234
Database Name: BobsData

mysqldump -u bobbyjoe -p happy234 BobsData > BobBackup.sql
This will backup the database to a file called BobBackup.sql

Explore PHP / MySQL

About.com Special Features

PHP / MySQL

  1. Home
  2. Computing & Technology
  3. PHP / MySQL
  4. Learn MySQL
  5. Backup MySQL - Restore MySQL - Save and Upload MySQL

©2009 About.com, a part of The New York Times Company.

All rights reserved.