September 16, 2019

Textual description of firstImageUrl

Restore WordPress Database Backup With phpMyAdmin

|
This is the tutorial on how to restore or import WordPress database backup with PhpMyAdmin so that you can get your WordPress site back to as before.

It is very simple process to import back the export backup data which you have kept in your computer and also in an external hard drive.

Just follow closely and you should restore your backup database without a hitch in no time.

restore wordpress database backup phpmyadmin

Note: For those whose site has been hacked, then before you continue to import the database back, you need to change your MySQL username and password and also delete it away and create a new database folder as explained below:



Clear Old Database

Before you start restoring back with your backup, you need to clean up the old database.

Make sure you clear out old data before restoring a backup.

If there’s any old data, it isn’t overwritten when you restore.

This can create duplicate tables, causing errors and conflicts.

This is what you do to clean up the data table.

1. Log in your cPanel.

2. Click on "phpMyAdmin" listed under "DATABASES" section.

3. It will open a new page.

4. On the left side of this new page, click on the site which you want to restore.

5. Then it will open another new page with a table of information.

6. Scroll down to the bottom of the table, click on "Check all".

7. Next to it, click the drop-down menu.

8. Click on "Drop".

9. The tool will prompt you to confirm that you want to go proceed. Click "Yes".

10. That's all.

This will get rid of all the existing data.

Yes, you start with a clean slate ready for you restore back the database with your backup.



Create New Database

Here is how to create a new database via "MySQL Databases".

1. Log in to your cPanel.

2. Click on "MySQL Databases" listed under Databases section.

how to create new database

3. It will open a new page where you need to create a new database.

4. Now in the "New Database:" text box, type the name of the database.

5. Click on "Create Database" button.

6. Once it finishes, click "Go Back".

7. Scroll down to "Add User To Database".

8. In the "User" list box, select the correct user that you want to add.

9. In the "Database" list box, select the new database.

10. Click the "Add" button.

11. Select the "ALL PRIVILEGES" check box.



create new database in cPanel

12. Click "Make Changes".

The cPanel adds the user to the database.

After you have created a new database in cPanel, you can import the database backup.


Note: You can also create a new database with "MySQL Database Wizard".

How To Import Backup Database

1. Log in to cPanel.

2. Click on "phpAdmin" in the "DATABASES" section.

3. In the left side of the phpMyAdmin page, click the database that you want to import the data into.

4. Click on "Import" tab on the top of the page.

5. It will take you to the "Importing into the database" page.

6. Under the "File to import:" section, click on "Browse" or "Choose File" button.

restore database MySQL with phpMyadmin

7. Here you can choose file and the select the saved database from where you have stored it. (your computer or external hard drive as suggested in my backup tutorial).

8. Scroll lower down and check to ensure under the "Format" section, it is selected as "SQL".

restore Wordpress backup database with phpAdmin

9. After choosing your backup or saved database file, click on the "Go" button.

10. Now phpMyAdmin will start importing your backup database.

11. That's all.

Now you should get your WordPress back up and running right away.

Note: Some of you may encounter importing trouble because the size of database is too large, then you should read this guide on how to import large database to MYSQL Database.

Importing Errors

You may receive one of the following errors when you try to import a MySQL database:

ERROR 1044: Access denied for user 'username1'@'localhost' to database 'username2_database'

This error message means when the import file contains an SQL statement that attempts to access a database for the wrong username.

To fix this error:

1. Open the backup SQL file in a text editor (Notepad).
  
2. Delete the lines that begin with CREATE DATABASE and USE.

For example:

CREATE DATABASE `newdbname` DEFAULT CHARACTER SET latin1 COLLATE

latin1_swedish_c$ USE `newdbname`;


and

USE `newdbname`;

3. Your text of the CREATE DATABASE statement is different from my example here.

4. Make sure to delete everything from the beginning of the line through, and including, the semi-colon at the end of the line.

5. After you have that, save your edited SQL file.

6. Now try importing your SQL file again.

7. That's all.

ERROR 1049: Unknown database 'username_database'

This error message happens when the target database does not exist.

Make sure you create the database first as explained above, and then try to it import again.

ERROR 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'username_database' at line x.

This error means when the import file does not contain backup data for a database or there is a MySQL syntax error in the file.

Or the import file may be altered, corrupt, or in an unsupported format.

*Import files must contain SQL statements; other file formats such as CSV do not work with the mysql program.

Try exporting the database again, and then try to import it.