There are two ways to import databases to MariaDB/MySQL. You can either use the phpMyAdmin, or by using the terminal command
mysql over SSH.
If you are not familiar with terminal commands you stick to the phpMyAdmin way.
Database Import with phpMyAdmin
When using phpMyAdmin you can easily go to the import tab, choose the file you want import and click finish.
Database Import from the Command Line
When using terminal for importing a database all you have to do is upload the database dump to the server using
rsync or SFTP. Once the file is located on the server you can run the following command (replace USERNAME, DATABASENAME and FILENAME):
mysql -u USERNAME -p DATABASENAME < FILENAME.sql
When hitting enter, you are asked to enter the database password. After filling in the correct password, the server will do the rest.
How to check if a database import was successful
After importing your database, you want to make sure that all the tables and their content were successfully and correctly imported, to verify that everything is running as expected. This can easily be done by logging in to your database in phpMyAdmin. In the example below we’ll be checking the table named wp_options to see if the site’s URL is correct. Please note that this is based on a standard WordPress installation, and that the table names and setup might differ in your own database.
First you click the database name on the top-left side to see all the tables in your database. To check the content of the table named ‘wp_options’, click on the table in the left side menu. In the snapshot above you can see that we have navigated to the “Browse” tab in the top menu bar, this is where you can see the content of the table. The option_name we want to look at is “siteurl” and we can see the content of that on the right side in the option_value section.
Go through your tables, and make sure everything is in place and that the correct content has been imported and is working as expected.
Are there unanswered questions you have? Please submit your comments and we’ll get them answered!
Give us your feedback on this article
Servebolt has launched Accelerated Domains!
Accelerated Domains is a service that greatly improves and optimizes your site on these four areas: Performance, Scalability, Security and the Carbon footprint of your website.