mysql备份数据库文件_将MySQL数据库备份到文件

mysql备份数据库文件_将MySQL数据库备份到文件

mysql备份数据库文件

Backing up your database is a very important system administration task, and should generally be run from a cron job at scheduled intervals. We will use the mysqldump utility included with mysql to dump the contents of the database to a text file that can be easily re-imported.

备份数据库是一项非常重要的系统管理任务,通常应按计划的时间间隔从cron作业运行。 我们将使用mysql附带的mysqldump实用程序将数据库的内容转储到可以轻松重新导入的文本文件中。

Syntax:

句法:

mysqldump -h localhost -u root -pmypassword databasename > dumpfile.sql

mysqldump -h localhost -u根-pmypassword数据库名> dumpfile.sql

Example:

例:

mysqldump -h localhost -u root -p2Uad7as9 database01 > dumpfile.sql

mysqldump -h localhost -u根-p2Uad7as9 database01> dumpfile.sql

This will give you a text file containing all the commands required to recreate the database.

这将为您提供一个文本文件,其中包含重新创建数据库所需的所有命令。

翻译自: https://www.howtogeek.com/howto/mysql/backup-mysql-database-to-a-file/

mysql备份数据库文件