Exporting and Importing MariaDB/MySQL Databases

To export a database use the following command:

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

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

jhudgins has written 34 articles

Leave a Reply