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).
On your dashboard, select the cPanel Admin button that appears above Settings.
On the next page, choose Backup Wizard under the ‘Files’ section.
For the first step, click the option Restore.
For the second step, select the option Home Directory.
Click Choose File and select the Home Directory backup that you’ve downloaded from your current host. Once done, select ‘Upload’.
A new window will appear informing you that the restore process has been completed. Close this window and select Go Back.
You’ll now need to do a similar process for your MySQL databases. Click the option MySQL databases on the second step page.
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.
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.
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).
On your dashboard, select the option phpMyAdmin from the navbar.
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”.
This will open up phpMyAdmin. Click on your database in the top left-hand corner.
Once done, select the Import tab.
Click the ‘Choose File’ button and select the database you wish to import.
Always ensure that the SQL option for ‘Format of imported file’ is selected.
Select the ‘Go’ button to begin the process.
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.
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.
Access SSH as the root user.
Log in to MySQL by entering ‘mysql -u username -p’, replacing the word ‘username’ with your database’s username.
Enter your database password into the Enter password field.
If you couldn’t enter the use database command in the .SQL file earlier, type use database_name; and press Enter on your keyboard.
Type SOURCE /path/to/sql/file.sql, and press Enter.
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.
From there, type select * from table; and press Enter. You will now see your imported MySQL database tables.