How to Import a MySQL Database Backup (.sql File)

If you are moving to Shockbyte from another host or have an existing database you wish to move to our servers, you can follow this guide to import your database backup.

You can import a database backup (.sql file) to your server database via PHPMyAdmin, or by a tool such as MySQL Workbench. Alternatively, if you are an advanced user you can also use the MySQL client via command line to connect directly to your database.

Prerequisites:

  • Before following this guide, you will need a backup file of the database you wish to import, in .sql format.

Importing a Database Backup via PHPMyAdmin

  1. On the server control panel, navigate to Advanced > MySQL Database. On this page, you will find your database login details (if you don't have a database yet, hit create).
  2. Click the Administration Link. This will take you to the PHPMyAdmin database management panel. If you see a popup box requiring a login, enter the Admin username and password.
  3. Once the PHPMyAdmin page loads, you will see a login form with the PHPMyAdmin logo. Enter your "Username" and "Password" from the MySQL Database page to login.
  4. Once logged in, select your database on the left hand side. It will be named similar to: db_0001
  5. Click "Import" on the menu at the top.
  6. You will now see an option to upload a .sql or .sql.zip file. Upload your database backup to this page, then click Go.
  7. Once the upload is complete, the database will be imported and everything is complete.

Note that there is a file size limit (2MB) and a time limit to upload the file. If your .sql file is larger than the requirements, you will need to connect to your database directly using the method below, rather than the web interface.

Importing a Database Backup via MySQL Workbench

  1. Download and install the community edition of MySQL Workbench for your operating system at: https://dev.mysql.com/downloads/workbench/
  2. Once you have opened MySQL Workbench, add a new connection by clicking the + button next to "MySQL Connections" (alternatively, navigate to Database > Manage Connections).
  3. Enter a name for the connection and your database login details. These can be found on the server control panel, under the Advanced > MySQL Database page. If you don't have a database yet, hit create. If you see an error here, it usually means you have entered the details incorrectly. However, if it connects successfully but a warning message is displayed, the warning can usually be safely ignored as long as the connection is working correctly.
  4. Once you have entered your details and connected to the database in MySQL Workbench, click "Server" along on the top bar, then "Database Import" on the dropdown menu.
  5. On the import page, click "Import from Self-Contained File" and choose the .sql file you wish to import. Then, select your database as the "Default Target Schema".
  6. Click the "Import Progress" tab, then select "Start Import".
  7. Allow the database to be uploaded and imported entirely. The time this takes can range from a few minutes, to several hours depending on the size of the database you're uploading and your internet speed.

Importing a Database Backup via Command Line

This is an advanced method and MySQL Workbench essentially operates the but with a graphic interface, so we won't explain this in full. However, if you know how to run MySQL via command line, you can input your connection details into this command to import your .sql file: mysql -h YOURMYSQLHOST -u YOURDBNAME -p YOURDBNAME < YOURSQLFILE.sql

If you require any further assistance, please contact our support at: https://shockbyte.com/billing/submitticket.php

Mitchell Smith

Managing Director @ Shockbyte

  • MySQL Database, SQL
  • 0 Users Found This Useful
Was this answer helpful?