How to dump one database for backup

# [mysql dir]/bin/mysqldump -u username -ppassword –databases databasename >/tmp/databasename.sql

To dump a MySQL database for backup, you can use the mysqldump command. Here’s the basic syntax:

bash
mysqldump -u username -p database_name > backup_file.sql

Replace username with your MySQL username, database_name with the name of the database you want to backup, and backup_file.sql with the name you want to give to your backup file. After running this command, you’ll be prompted to enter your MySQL password.

If you want to backup all databases, you can use the --all-databases option:

bash
mysqldump -u username -p --all-databases > all_databases_backup.sql

Again, replace username with your MySQL username, and after running this command, you’ll be prompted to enter your MySQL password. This will backup all databases into a single file named all_databases_backup.sql.

Remember to keep your backup files in a secure location!