Backup/Restore Mysql database

Last update on June 9, 2009 09:50 AM by jak58
Published by jak58

Backup/Restore Mysql database





A simple approach on how to backup and restore MySQL databases.

Backup


To save an existing database it is recommended that you create a dump.
  • To dump all databases you must run the command:



mysqldump --user=****** --password=****** -A > /path/to/file_dump.SQL
  • To dump several specific databases you must run the command:



mysqldump --user=****** --password=******  db_1 db_2 db_n> /path/to/file_dump.SQL
  • To dump all tables from a database you must run the command:



mysqldump --user=****** --password=****** db > /path/to/file_dump.SQL
  • To dump specific tables from a database you must run the command:



mysqldump --user=****** --password=****** db --tables tab1 tab2 > /path/to/file_dump.SQL



For each of the following commands you must specify a user (user) and password (password) with administrator rights on the database.

Restore your database


To restore a dump just launch the command:

mysql --user=****** --password=****** db_name < /path/to/file_dump.SQL

Note


A database dump: is a record of the table structure and the data from a database, usually in the form of a list made of SQL statements.
Best answers for « Backup/Restore Mysql database » in :
Automatic backup of a Database in SQL EXPRESS 2005 Show Automatic backup of a Database in SQL EXPRESS 2005 If you want to automate a backup of a database in SQL Server Express, there is a simple solution using a .bat. file. Create a new text file. This file should contain the following...
Backup / Restore registry ShowBackup / Restore registryr Save the registry Restore the registry Sometimes we come from in our hapless hack the registry to "optimize" our system. Although these changes are not recommended, you can modify a frenzy deleted key...
Restoring your Nokia phone ShowRestoring your Nokia phone Normal Reset Deep Reset How to proceed There are two methods allowing you to reset your phone to a more unwavering state. Normal Reset Using the *#7780# sequence. It will restore ini files from ROM...
Reinitializing the root password of MySQL ShowReinitializing the root password of MySQL The root password is lost! Reinitializing the password: It's important that you are able to access and modify the admin (root) password of MYSQL, either when installing MySQL for the first...
ODBC ShowWhat is ODBC? ODBC stands for Open Database Connectivity. This is a Microsoft-defined format for communicating between Windows database clients and consumer DBMSs. The ODBC managier can be found in Windows 3.1 and 9x. In Windows 95 and 98, it is...
Backup ShowBackup Setting up a redundant architecture ensures that system data will be available but does not protect the data against user-introduced errors or against natural disasters such as fires, floods or even earthquakes. Therefore it is necessary to...
Introduction - Databases ShowWhat is a database? A database (abbreviated DB) is an entity in which data can be stored in a structured manner, with as little redundancy as possible. Different programs and different users must be able to use this data. Therefore, the concept of...