Using mysqldump to backup your data:
First of all you have to check if the MySQL bin directory is in your PATH or not. Simply try to execute the mysqldump command. If the file was not found then you can extend your PATH or switch to the MySQL bin directory. For example on my Windows machine it is: D:\Program Files\MySQL\MySQL Server 5.0\bin\ Mysqldump creates an sql file as the result of the backup. Later you simply can execute this file to recreate the MySQL database. You can backup only some tables, the complete database or all available databases depending on how you call mysqldump. The most simple way to backup a single MySQL database on web hosting is the following:
Code:
mysqldump -r c:\backup\myDb.sql myDb
This code generates the backup of the myDb database in the c:\backup directory.
Backup database with username and password:To backup our myDb database with username and password is the following:
Code:
mysqldump -u user -ppassword -r c:\backup\myDb.sql myDb
Backup only some tables:
An other common wish is to export only some tables instead of the complete database. It is quite easy with mysqldump. You simply have to list the tables you want to export after the database name like here:
Code:
mysqldump -u user -ppassword -r c:\backup\myDb.sql myDb user error
Backup all databases:
The last method I want to present in this tutorial is the backup of all available databases at once. Fortunately this is really very easy task. Simply use the --all-databases option as here:
Code:
mysqldump -u user -ppassword -r c:\backup\myDb.sql --all-databases



