sábado, agosto 04, 2012

How to Backup & Restore your Database on MySQL

 Source: https://help.fasthosts.co.uk/app/answers/detail/a_id/1404/~/back-up-and-restore-mysql-databases-using-mysql-workbench

Backup your database

MySQL Workbench can export a backup of your database to a file on your local computer. This is also sometimes referred to as a data dump.

Step 1

Click Manage Import / Export under Server Administration on the right of the Workbench window. If you cannot see this option, make sure the Home tab is selected.
Image

Step 2

Select your database and click OK.
Image

Step 3

Enter your database password if prompted.

Step 4

Select the Export to Disk tab.

Step 5

In the Select Database Objects to Export section, select your database by checking the relevant box in the Export column.
Image

Step 6

Select the tables you wish to export. Click Select All Tables if you would like to export the contents of your entire database.
Image

Step 7

Choose where you would like to save your database backup. There are two options available:
  • Export to Dump Project Folder: MySQL Workbench will create a seperate backup file for each table in your database, which will make it possible to store selected tables in the future without the need to restore the entire database.
  • Export to Self-Contained File: All selected tables will be exported to one single SQL file.
Select a location to save your backup.
Image

Step 8

Click Start Export and enter the database password if prompted.

Restore your database from a previous backup

Step 1

Click Manage Import / Export under Server Administration on the right of the Workbench window. If you cannot see this option, make sure the Home tab is selected.
Image

Step 2

Select your database and click OK.
Image

Step 3

Enter your database password if prompted.

Step 4

Select the Import from Disk tab.
Image

Step 5

When you created the backup you were presented with the option to export your database tables to a folder or a single self-contained file. This step will differ depending on which option you chose.

Import from Dump Project Folder

Select Import from Dump Project Folder and enter the location in the Folder Path text field. Click Load Folder Contents.
Image
Select which tables from the backup you would like to restore.
Image

Import from Self-Contained File

Select Import from Self-Contained File and enter the location in the File Path text field.
Image

Step 6

Click Start Import and enter the database password if prompted. This process may take several minutes depending on the size of your database backup.