Knowledgebase

Import / export mysql or maria database using linux terminal

To import and/or export a MySQL or MariaDB database, you will need:

  • Access to the Linux server terminal
  • The database name, user, and password of it

Exporting the Database

mysqldump is a powerful tool which is used to export the MySQL or maria database.

Export the database using the following command :

username -pdatabase_name > filename.sql

  • username is the user assigned to the database
  • database_name is the name of the database that will be exported
  • filename.sql is the file in the current directory that the output will be saved to

Importing the Database

You can import any SQL or compressed database backup file (.zip) by using the following command :

mysql -u username -p database_name < filename.sql

The command will not print any output. If your backup file is large, you need to wait a bit for it to execute all the queries of the file. Stay patient and wait for the command to finish.

 

  • Import or export mysql database, Import or export maria database
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

System Requirements

Most current web servers with PHP & MySQL installed will be capable of running WHMCS. The...

Common logs file paths

Log files are helpful in troubleshooting issues and in monitoring the performance of cPanel...

Disable ModSecurity in cPanel

What is ModSecurity?Mod_security is an apache module that helps to protect your website from...

How to disable directory listing in cpanel?

Disable directory listing in cpanelIndex Manger in cPanelThe Index Manager allows you to...

How to disable the listing in a non-cPanel CentOS server?

How to disable the listing in a non-cPanel CentOS server?1. Locate your httpd.conf file. Normally...