How to backup and restore data in MySQL?
In MySQL, you can use the mysqldump command to back up a database and use the mysql command to restore it.
Back up data:
mysqldump -u username -p database_name > backup.sql
Restore data:
mysql -u username -p database_name < backup.sql
The -u parameter is used to specify the username, while the -p parameter is used to specify the password. The database_name is the name of the database to be backed up or restored, and backup.sql is the name of the backup file. During data backup, the data is exported from the database to the backup.sql file; during data restoration, the data from the backup.sql file is imported into the database.