You can easily import/export your database using phpMyAdmin menu in cPanel. To do so, follow the instructions,It allows processing only the databases that do not exceed 50Mb. If your database is bigger, you will need to use SSH commands.
Shell access is disabled on shared servers by default, so if shell access was not enabled for your account previously, first of all, please submit a ticket at our HelpDesk using Hosting – Support department with the request to enable jailed shell for your account.
The next step is to log into your account via SSH. This tutorial will guide you through this process.
Note that before performing an export or import, you will need to assign a database to a user. You can do it in cPanel > MySQL Databases menu > Add a User to a Database option:
Make sure that you enable All Privileges option:
You can find more instructions on database creation and assigning it to a user.
In order to import a database, use the following command:
mysql -u dbusername -pdbpassword dbname < /path/to/file/file.sql
In order to export, use this one:
mysqldump -u dbusername -pdbpassword dbname > /path/to/file/file.sql
The variable in italics are the following:
NOTE: No space between -p key and the password if you enter it in the command.
If you do not receive any error or notification after pressing Enter, it means that the command was performed successfully.
Let us provide with an example.
We will use the following settings:
After defining all the variables, the command will look the following way:
Database import
mysql -u nctests_user -p123qwe nctests_database < /home/nctests/public_html/databases/db_file.sql
NOTE: You can also use the following command:
mysql -u nctests_user -p nctests_database < /home/nctests/public_html/databases/db_file.sql
This way, you need to enter the password in the next line:
Database export
mysqldump -u nctests_user -p123qwe nctests_database > /home/nctests/public_html/databases/db_file.sql
NOTE: You can also use the following command:
mysqldump -u nctests_user -p nctests_database > /home/nctests/public_html/databases/db_file.sql
This way, you need to enter the password in the next line: