Quy trình khôi phục
- Tạo database đích (nếu chưa có) và
USEnó. - Chạy lệnh
SOURCE path/to/dump_file.sql;trong client MySQL.
Ví dụ
Khôi phục student_info.sql (dump từ DB query) vào DB tutorials:
mysql> USE Tutorials; Database changed mysql> SOURCE student_info.sql; Query OK, 0 rows affected ... (nhiều dòng) Query OK, 7 rows affected (0.05 sec) Records: 7 Duplicates: 0 Warnings: 0
Kiểm tra:
mysql> SHOW TABLES; +---------------------+ | Tables_in_tutorials | +---------------------+ | rtgs | | student_info | +---------------------+ mysql> SELECT * FROM Student_info; +------+---------+------------+------------+ | id | Name | Address | Subject | +------+---------+------------+------------+ | 101 | YashPal | Amritsar | History | | 150 | Saurabh | NULL | Literature | +------+---------+------------+------------+