In fact, you can use mysqldump to perform smart backups. If you want to backup a table, you can use mysqldump like this:
bash code
mysqldump -u [username] -p [database_name] [table_name] > [ data_backup .txt] SQL ] |
For example, if your database name is my_database and you need to backup a table named my_table, you can store the backup in a file named my_table_backup.sql like this:
bash code
mysqldump -u root -p my_database my_table> my_table_backup.sql |
Restore table
You can optionally use the mysql command to restore the table like this:
Option 1: Use the SOURCE command to edit the table data:
bash code
mysql -u root -p my_database |
Log in and run:
SQL code
SOURCE /path/to/my_table_backup.sql; > |
Option 2: Restore the table directly with a command without entering the MySQL shell:
bash code
mysql -u root -p my_database < my_table_backup.sql |
This will read the contents of my_table_backup.sql and restore my_table to my_database.