Exporting and Importing MariaDB/MySQL Databases

  Linux

To export a database use the following command:

mysqldump --add-drop-table -u username -p dbname > dbname.sql

NOTE:
Omit the –add-drop-table argument if you plan to merge this backup with an existing database when you import it. This option means the backup will totally replace the old database when it is imported.

Import the database by executing the following command:

mysql -u username -p dbname < dbname.sql

LEAVE A COMMENT