How To Restore A Database

Table of contents:

How To Restore A Database
How To Restore A Database

Video: How To Restore A Database

Video: How To Restore A Database
Video: Restore Database from a BAK File in SQL Server 2024, December
Anonim

Experienced administrators know firsthand that saving a database backup and restoring it will save a lot of your work as a result of an unforeseen failure. Therefore, the ability to restore a database is an essential administrative skill.

How to restore a database
How to restore a database

Instructions

Step 1

To restore a database, you need to have it backed up with the latest changes. To do this, after each new operation or before experimenting with your database code, import it to your computer as an archive or sql file.

Step 2

Open your browser. In the address bar, enter: localhost. Select Phpmyadmin from the suggested values. Go to Phpmyadmin panel. First, delete the tables that were damaged by the crash. To do this, select the name of the relevant database in the left column and in the list of tables that opens, click the link below "Mark all". Then click on the "With marked" field and select "Delete" from the list that opens. Confirm the action in the pop-up window.

Step 3

Now navigate to the folder on your computer where the saved database is stored. If you saved it in sql format, then just open the document and copy the document code to the clipboard (Ctrl + A - select, Ctrl + C - copy). After that, log into Phpmyadmin, select the database to be restored, and in the SQL tab, paste the content (Ctrl + V) into the query input field.

Step 4

Click "OK", and after a certain time, if the operation is successful, the message "SQL query completed successfully" will appear in the command line. If this does not happen, then the tables are too large, and it is better to load it into the database via the import command.

Step 5

Zip your sql file using Winrar or 7-Zip. Please note that the name of your file must contain the format and compression (for example, base.sql.zip). After you have correctly registered the name of the file, go back to Phpmyadmin, select the required database and go to the "Import" tab.

Step 6

By clicking "Select File", use the Explorer to find the archive you just made. Select it, set the encoding to utf-8. Click the checkmark next to the words "Allow the script to break the import process" and select the SQL format. Click the "Ok" button. If no new errors occur, you will receive a message: "File import completed successfully."

Recommended: