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.
These instructions are for importing a database backup of a site hosted at Kinsta. If you’re trying to import a database as part of a migration to Kinsta, check out our guide on Migrating Your Site to Kinsta.
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.
Log in to MyKinsta, go to WordPress Sites and select your site in the list.
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.
Log in to phpMyAdmin with the Database username and Database password shown in MyKinsta.
Before importing your database, making sure the existing database is empty is recommended to prevent possible duplication of data. To do that:
- Click on your database name.
- Scroll down if necessary and check the box next to Check all to select all of your database tables.
- In the dropdown menu next to that, select Drop.
- On the next page, confirm the
DROP TABLEquery by clicking Yes.
Click on the Import tab and then click the Choose file/Browse button. Select your *.sql file, scroll down, and click Go.
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.
Connect to your site with SFTP and go to the public directory.
Upload your database file.
Connect to your server with SSH and navigate to the public directory:
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
Import your database file (replace db-backup-name.sql with the actual file name):
wp db import db-backup-name.sql
Once your database is imported, delete the database file from the server using either your FTP client or via SSH with this command: