How do I import a MySQL database?

This article will show you how to import your database into your hosting package.

You can import an existing database that you own onto your 123 Reg hosting package.

The step-by-step instructions below will help you to complete this procedure. If you need to export your database instead, read our Support article to find out how to do this.

Via cPanel

Please note: the following steps apply to Web Hosting plans purchased after July 2020 and Premium Hosting plans purchased after August 2020 (cPanel).

Step 1 of 10

Start by accessing your Web Hosting dashboard.

 

Step 2 of 10

On your dashboard, select the cPanel Admin button that appears above Settings.

Dashboard

 

Step 3 of 10

On the next page, choose Backup Wizard under the ‘Files’ section.
cPanel Admin

 

Step 4 of 10

For the first step, click the option Restore.
Restore

 

Step 5 of 10

For the second step, select the option Home Directory.

Home Directory

 

Step 6 of 10

Click Choose File and select the Home Directory backup that you’ve downloaded from your current host. Once done, select ‘Upload’.

Upload

 

Step 7 of 10

A new window will appear informing you that the restore process has been completed. Close this window and select Go Back.

 

Step 8 of 10

You’ll now need to do a similar process for your MySQL databases. Click the option MySQL databases on the second step page.

MySQL

 

Step 9 of 10

Select Choose File and upload the backup you’ve downloaded from your current host. You’ll need to repeat this process for each database that you backed up.

MySQL Upload

 

Step 10 of 10

You’ll also need to do a similar process for your email forwarders. On the second step page, click the option Email Forwarders & Filters, followed by Choose File and upload the backups you’ve downloaded from your current host.

Email Forwarders

 

Via phpMyAdmin

Please note: the following steps apply to Web Hosting plans purchased after July 2020 and Premium Hosting plans purchased after August 2020 (cPanel).

Step 1 of 8

Start by accessing your Web Hosting dashboard.

 

Step 2 of 8

On your dashboard, select the option phpMyAdmin from the navbar.

phpMyAdmin

 

Step 3 of 8

If you haven’t already done so, you’ll need to create a new database. Otherwise, skip to step 7. Simply choose a username and password and click on the Create button.

Please note: Your username should be 9 characters or less and can only contain letters, numbers and these characters: “_” and “-“. It should not contain the words “test”, “root”, “mysql” nor “alive”.

 

Step 4 of 8

This will open up phpMyAdmin. Click on your database in the top left-hand corner.

Database

 

Step 5 of 8

Once done, select the Import tab.

Import

 

Step 6 of 8

Click the ‘Choose File’ button and select the database you wish to import.

Choose File

Always ensure that the SQL option for ‘Format of imported file’ is selected.

 

Step 7 of 8

Select the ‘Go’ button to begin the process.

Go

 

Step 8 of 8

Once complete, you will see a message stating that the import was successful.

 

Via SSH

Please note: The below SSH method is a more advanced method that involves more technical knowledge.

Step 1 of 8

Open your .SQL file in your hosting text editor.

You should see a use database command near the top, but don’t worry if you can’t as you can add it as soon as you’ve logged in to MySQL.

 

Step 2 of 8

Access SSH as the root user.

 

Step 3 of 8

Log in to MySQL by entering ‘mysql -u username -p’, replacing the word ‘username’ with your database’s username.

 

Step 4 of 8

Enter your database password into the Enter password field.

 

Step 5 of 8

If you couldn’t enter the use database command in the .SQL file earlier, type use database_name; and press Enter on your keyboard.

 

Step 6 of 8

Type SOURCE /path/to/sql/file.sql, and press Enter.

 

Step 7 of 8

Keep an eye on the running import log in case any errors occur. To make sure that your data was imported correctly, type show tables; and press Enter.

 

Step 8 of 8

From there, type select * from table; and press Enter. You will now see your imported MySQL database tables.