Cú pháp backup single database
mysqldump -u root database_name > output_file.sql
Ví dụ
Backup database tutorials ra tutorials.sql:
C:\mysql\bin> mysqldump -u root tutorials > tutorials.sql
File tutorials.sql chứa: DROP TABLE, CREATE TABLE, INSERT cho tất cả bảng. Ví dụ phần dump bảng rtgs:
-- Table structure for table `rtgs` DROP TABLE IF EXISTS `rtgs`; CREATE TABLE `rtgs` ( `id` int(11) DEFAULT NULL, `name` varchar(20) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- Dumping data for table `rtgs` LOCK TABLES `rtgs` WRITE; INSERT INTO `rtgs` VALUES (1,'Ram'),(2,'Shyam'); UNLOCK TABLES;