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