In this article, we shall focus on how to import a database in Cpanel, how to export a database from Cpanel, and also importing and export tables to or from the Cpanel.
Importing a database to the Cpanel refers to the process of moving a database from a local storage space to an online hosting space which is supported by the Cpanel. This process is important and necessary to all those that they have purchased a domain and hosted their website on a live server or those that they might have moved their database from one server to another server
Exporting a database from a Cpanel refers to the process followed when a database is hosted in an online hosting space which for this case is the Cpanel and downloading it and storing it to a local storage space in your computer.
Exporting a database acts as an important factor when you want to have a backup of the database in your local machine and also if you want to transfer the database to another hosting space.
Please note that when you are exporting a database, it is not deleting the database or moving it to another location, it is actually copying the files while leaving the original copy of the data in the location it was.
You can either import a database or a single database table and you can either export a database or an individual table
How to import a database to Cpanel
Like we have defined above, it involves uploading database files to the Cpanel
To do this, you have to ensure you have created a database in the Cpanel. Follow this previous article and learn or remind yourself how to create a database in Cpanel
- First, you will need to login to your Cpanel
- Navigate to the databases section and select PHPMyAdmin
- open the PHPMyAdmin link and you will be redirected to the section where your databases are
- On the left sidebar, your databases will be listed there. Select the database which you want to add data on
- the database interface will be opened
- if there are no existing tables in your database, the table section will be blank
To import a database, you need to mark the location of the database on your computer. Mostly database files are .sql files
- click the import link in the navigation section and the screen below will open
There are two options to import the database to the Cpanel
- clicking the choose file button in the interface which will open a modal with the storage directories for your computer
Navigate to the folder where your database is and click on it to upload
- method 2 involves drag and drop
you select the database file you want to upload and drag it to the import database interface
Wait for the upload to finish
Once you click the database in the left sidebar you will see the contents of the database which will have been imported to the Cpanel database
How to import database tables to Cpanel
The process of importing tables to the Cpanel is the same as that of importing database the difference is only that you will be importing a single database table
How to export a database from Cpanel
The database must exist in the Cpanel first
To do this;
- once inside the PHPMyAdmin section, select the database you want to export
- Click on the Export link in the navigation section
- The above screen has two options, quick and custom. The quick option means you export the whole database as it is while the custom option gives you an option to choose some tables which you don’t want to export. By default, we use the quick option
- In the format section, you can choose the format you want your database saved from SQL, CSV, excel, pdf, and many more. We use SQL in most cases
- Click go and a modal will popup so that you can choose where you want to store the database inside your computer
- Select the destination and click save
Your database will be exported from the Cpanel database to your local storage on the computer
To export a single database table, you will need to select the table first and then follow the steps above
That’s it for this article, hope you have learned how to import a database to the Cpanel and also how to export a database from the Cpanel