如何执行 MySql\MariaDB 数据库的完整备份?

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

如何执行 MariaDB (MySql) 数据库的完整备份(我的意思是表创建和这些表中的数据)?

我使用命令行连接到这个数据库。

一个好的方法是使用 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.

可以这样使用:

$ mysqldump db_name > backup-file.sql

您可能已经安装了它,因为它是默认的 command-line 工具之一。

https://dev.mysql.com/doc/refman/5.7/en/backup-methods.html 这是备份的官方参考