Export and import of database in terminal


EXPERIENCING PROBLEMS WITH OUR SERVICES? RUN A DIAGNOSE FIRST TO SAVE YOURS AND OUR TIME

Added: 04.10.2018 15:20:54     Last updated: 09.11.2018 14:35:14

This guide will show you how to proceed to create an export (backup) of a MySQL/MariaDB database, via terminal in cPanel.
All our web hosting, except Pro Start have access to terminal in cPanel.
It is also possible to create an export via phpMyAdmin in cPanel or via other software such as putty and MySQL Workbench.

Step 1:
Click on the icon for "Terminal" as shown below.

Terminal (SSH) in cPanel

Step 2:
If this is the first time you are using terminal, you will see a warning. If you are familiar with terminal you can proceed.

First time accessing SSH/Terminal

Step 3:
In order to export a database you need to know databasename, user and password.
When you have this, you can use this command: mysqldump -p -u username database_name > dbname.sql
You need to replace username, database and the name for the file you want.

Import of database terminal

Step 4:
In this example we will show you how to import a .sql file to a new database.
Here we use this command: mysql -p -u username database_name < dbname.sql

Import of database in terminal in cpanel

Done
We have now showed you how to export and import a database in terminal in cPanel.



Live chat Live chat