Search code examples
mysqldatabasemariadbrdbms

How to perform a full backup of a MySql\MariaDB database?


how can I perform a full backup of a MariaDB (MySql) database (I mean tables creation and data inside these tables)?

I connect to this database using command line.


Solution

  • A good way to do this would be to use mysqldump:

    The mysqldump client (...) can be used to dump a database or a collection of databases for backup or transfer to another database server (not necessarily MariaDB or MySQL). The dump typically contains SQL statements to create the table, populate it, or both. However, mysqldump can also be used to generate files in CSV, other delimited text, or XML format.

    It can be used like this:

    $ mysqldump db_name > backup-file.sql
    

    You probably already have it installed, as it is one of the default command-line tools.