If you have hundreds of databases and want to restore all of them, these Best Practices are for you.
Individual database restore is much slower then a straight raw file restore of your MySQL data directory. When databases are restored individually (see [Restore a MySQL database to the original location]), each row must be selected and inserted and this takes a very long time. So we recommend to shut down your MySQL instance and restore your MySQL data directory using the *file restore* feature (see [Restore files]). Follow the instructions below.
----
{toc:location=top|maxLevel=3|minLevel=3|type=flat|separator=pipe|style=border:1}
----
h3. Windows
1. Identify the MySQL {{data}} directory.
!mysql1.png!
2. Stop the MySQL instance. The following screen-shot shows how to do it using the Windows MySQL Administrator.
!mysql2.png!
Alternatively, if you are using Windows, you can stop the MySQL service just like any other service. Open a command prompt (click "Start", select "Run", type {color:blue}cmd{color}, and click OK), type the following command and press <Enter>:
{code}net stop MySQL{code}
3. Move the contents of the data directory to another location as a backup.
4. Use the Backup Manager to perform a file restore of the MySQL {{data}} directory. Refer to [Restore files].
5. Start the MySQL instance. The following screen-shot shows how to do it using the Windows MySQL Administrator:
!mysql3.png!
Alternatively,you can start the MySQL service just like any other service. Open a command prompt (click "Start", select "Run", type {color:blue}cmd{color}, and click OK), type the following command and press <Enter>:
{code}net start MySQL{code}
h3. Linux
1. Identify the MySQL {{data}} directory. For this purpose you can use the {{show variables}} command as shown below.
!show-var.png!
2. Stop the MySQL instance using the following command:
{code}/etc/init.d/mysql stop{code}
!stop1.png!
3. Move the contents of the {{data}} directory to another location as a backup.
!cp.png!
4. Use the Backup Manager to perform a file restore of the MySQL {{data}} directory. Refer to [Restore files].
5. Start the MySQL instance using the following command:
{code}/etc/init.d/mysql start{code}
!start1.png!
{excerpt:hidden=true}Best practices for restoring an entire MySQL instance on Windows and Linux.{excerpt}
Individual database restore is much slower then a straight raw file restore of your MySQL data directory. When databases are restored individually (see [Restore a MySQL database to the original location]), each row must be selected and inserted and this takes a very long time. So we recommend to shut down your MySQL instance and restore your MySQL data directory using the *file restore* feature (see [Restore files]). Follow the instructions below.
----
{toc:location=top|maxLevel=3|minLevel=3|type=flat|separator=pipe|style=border:1}
----
h3. Windows
1. Identify the MySQL {{data}} directory.
!mysql1.png!
2. Stop the MySQL instance. The following screen-shot shows how to do it using the Windows MySQL Administrator.
!mysql2.png!
Alternatively, if you are using Windows, you can stop the MySQL service just like any other service. Open a command prompt (click "Start", select "Run", type {color:blue}cmd{color}, and click OK), type the following command and press <Enter>:
{code}net stop MySQL{code}
3. Move the contents of the data directory to another location as a backup.
4. Use the Backup Manager to perform a file restore of the MySQL {{data}} directory. Refer to [Restore files].
5. Start the MySQL instance. The following screen-shot shows how to do it using the Windows MySQL Administrator:
!mysql3.png!
Alternatively,you can start the MySQL service just like any other service. Open a command prompt (click "Start", select "Run", type {color:blue}cmd{color}, and click OK), type the following command and press <Enter>:
{code}net start MySQL{code}
h3. Linux
1. Identify the MySQL {{data}} directory. For this purpose you can use the {{show variables}} command as shown below.
!show-var.png!
2. Stop the MySQL instance using the following command:
{code}/etc/init.d/mysql stop{code}
!stop1.png!
3. Move the contents of the {{data}} directory to another location as a backup.
!cp.png!
4. Use the Backup Manager to perform a file restore of the MySQL {{data}} directory. Refer to [Restore files].
5. Start the MySQL instance using the following command:
{code}/etc/init.d/mysql start{code}
!start1.png!
{excerpt:hidden=true}Best practices for restoring an entire MySQL instance on Windows and Linux.{excerpt}