Den här artikeln finns även på: Svenska
Sometimes, you need to import a database backup, e.g. from a previous provider. There are two ways to do this, and this guide will detail both methods. Keep in mind that you need to create a database to where the backup should be imported (if you’re not overwriting the content of an existing database). These instructions detail how you create a database.
phpMyAdmin via cPanel
- Begin by logging on to cPanel.
- Then click the icon
- Once you’ve entered phpMyAdmin, you will see a list of your databases to the left. Click the one to which you’d like to import your backup.
- Now, in the menu at the top of the page, click the tab
Browseand select the SQL file you wish to import.
SQLas format, if it’s a SQL file you’re about to import. Finally, click
Goat the bottom of the page.
If your database file is larger than 200MB, you will not be able to import it via phpMyAdmin. If it too large, try compressing it and see if it becomes smaller than 200MB. If it’s still too large, you need to import it via SSH instead (use the uncompressed file), please read the instructions below.
Begin by uploading your SQL file to your account. You may use the File Manager found via cPanel for this purpose.
Then you need to connect to your web hosting account via SSH to run the import command below. This guide describes how you access your account via SSH.
Finally, run this command:
mysql -u username -p dbname < path/to/mysqlbackup.sql
username with the database username,
dbname with the name of the database, and enter the correct path to where you have uploaded the database file. You will then be prompted for the database user’s password.
Keep in mind that the database to where the backup should be imported (if you’re not overwriting an existing one) have to exist before you begin. These instructions detail how you create a database and database user via cPanel.