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 33 articles

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>