In MyKinsta, you can restore a backup that is a complete snapshot of your site’s environment (including files, database, redirects, and Nginx configuration). If you want to restore or import only your site’s database, this guide will show you a couple of different ways to do that.

This tutorial assumes you already have a backup or exported *.sql file, which you will be importing. If not, see our guide: How to Create a Database Backup.

Restore a MySQL Database Using phpMyAdmin

phpMyAdmin is a database management tool you can use to view, import, and export data in and out of your database.

Step 1

Log in to MyKinsta, go to Sites and select your site in the list.

Step 2

On the Info tab, scroll down to Database access. Click on the Open phpMyAdmin link, which will open phpMyAdmin in a new tab in your browser.

Open phpMyAdmin from MyKinsta.
Open phpMyAdmin from MyKinsta.

Log in to phpMyAdmin with the Database username and Database password shown in MyKinsta.

Step 3

Before importing your database, making sure the existing database is empty is recommended to prevent possible duplication of data. To do that:

  1. Click on your database name.
  2. Scroll down if necessary and check the box next to Check all to select all of your database tables.
  3. In the dropdown menu next to that, select Drop.
  4. On the next page, confirm the DROP TABLE query by clicking Yes.

Drop tables in phpMyAdmin.
Drop tables in phpMyAdmin.

Confirm you want to run the query to drop tables in phpMyAdmin.
Confirm you want to run the query to drop tables in phpMyAdmin.

Step 4

Click on the Import tab and then click the Choose file/Browse button. Select your *.sql file, scroll down, and click Go.

Select your .sql file to import in phpMyAdmin.
Select your .sql file to import in phpMyAdmin.

Restore a MySQL Database Using WP-CLI

If your database file is larger than 134 MB, or you’d prefer to use the command line, you can use WP-CLI to restore your database instead.

Step 1

Connect to your site with SFTP and go to the public directory.

Step 2

Upload your database file.

Step 3

Connect to your server with SSH and navigate to the public directory:

cd public

Step 4

Before importing your database, making sure the existing database is empty is recommended to prevent possible data duplication. The following command does that so you have an empty database to import to (the –yes flag answers the confirmation message without a separate prompt):

wp db reset --yes

Step 5

Import your database file (replace db-backup-name.sql with the actual file name) with:

wp export db-backup-name.sql

Step 6

Once your database is imported, delete the database file from the server using either your FTP client or via SSH with this command:

rm db-backup-name.sql