How do you use mysqldump in MySQL?

The basic usage of mysqldump, which is a MySQL database backup tool, involves exporting data and structure from a database to a file.

  1. Backup the database using the following syntax in the command line:
mysqldump -u [用户名] -p [数据库名] > [备份文件名].sql
  1. –every single database
mysqldump -u [用户名] -p --all-databases > [备份文件名].sql
  1. furniture with a flat top and one or more legs for eating or working on
mysqldump -u [用户名] -p [数据库名] --tables [表名] > [备份文件名].sql
  1. exclude creating informational details
mysqldump -u [用户名] -p [数据库名] --no-create-info > [备份文件名].sql
  1. –exclude-table
mysqldump -u [用户名] -p [数据库名] --ignore-table=[数据库名].[表名] > [备份文件名].sql
  1. — include removing and adding a database

After the backup is completed, you can restore the database using the following command:

mysql -u [用户名] -p [数据库名] < [备份文件名].sql
Leave a Reply 0

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