How do I import a MySQL database?

This FAQ will help you to import your database onto your Web 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

The following steps apply to Web Hosting plans purchased after July 2020 and Premium Hosting plans purchased after August 2020:

Step 1 of 12

Start by logging in to your Control Panel and scroll down to ‘Web Hosting’. From there, select Manage.

General Control Panel

 

Step 2 of 12

On the next page, select Manage for the account you wish to use.

Web Hosting Manage

 

Step 3 of 12

Select the three-dot icon for the package you want to edit. From there, choose Settings from the drop-down menu that appears.

cPanel Admin

 

Step 4 of 12

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

Dashboard

 

Step 5 of 12

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

 

Step 6 of 12

For the first step, click the option Restore.
Restore

 

Step 7 of 12

For the second step, select the option Home Directory.

Home Directory

 

Step 8 of 12

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

Upload

 

Step 9 of 12

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

 

Step 10 of 12

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 11 of 12

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 12 of 12

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

The following steps apply to Web Hosting plans purchased after July 2020 and Premium Hosting plans purchased after August 2020:

Step 1 of 10

Start by logging in to your Control Panel and scroll down to ‘Web Hosting’. From there, select Manage.

General Control Panel

 

Step 2 of 10

On the next page, select Manage for the account you wish to use.

Web Hosting Manage

 

Step 3 of 10

Select the three-dot icon for the package you want to edit. From there, choose Settings from the drop-down menu that appears.

cPanel Admin

 

Step 4 of 10

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

phpMyAdmin

 

Step 5 of 10

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 6 of 10

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

Database

 

Step 7 of 10

Once done, select the Import tab.

Import

 

Step 8 of 10

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 9 of 10

Select the ‘Go’ button to begin the process.

Go

 

Step 10 of 10

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

 

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

Via SSH

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.