窗口cmd执行
- 备份
mysqldump -u root -h 10.88.99.8 -p --databases 数据库1 数据库2 数据库 3 > backdb.sql
生成的语句类似:
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `zyws-employer-base` /*!40100 DEFAULT CHARACTER SET utf8 */;
USE `zyws-employer-base`;
--
-- Table structure for table `tb_hazards_factor`
--
DROP TABLE IF EXISTS `tb_hazards_factor`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tb_hazards_factor` (
`RID` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'RID',
`CREATE_TIME` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`CREATE_USER` bigint(20) NOT NULL DEFAULT '1' COMMENT '创建人',
`MODIFY_TIME` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
`MODIFY_USER` bigint(20) NOT NULL DEFAULT '1' COMMENT '修改人',
`IF_DELETE` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除',
`DELETE_TIME` datetime DEFAULT NULL COMMENT '删除时间',
`DELETE_USER` bigint(20) DEFAULT NULL COMMENT '删除人',
`HAZARDS_TYPE` char(4) DEFAULT NULL COMMENT '危害因素大类',
PRIMARY KEY (`RID`) USING BTREE,
KEY `FK_TB_HAZARDS_FACTOR` (`EMPLOYEE_ID`) USING BTREE,
CONSTRAINT `FK_TB_HAZARDS_FACTOR` FOREIGN KEY (`EMPLOYEE_ID`) REFERENCES `td_employer_basic` (`RID`)
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8 COMMENT='单位职业病危害因素';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `tb_hazards_factor`
--
LOCK TABLES `tb_hazards_factor` WRITE;
/*!40000 ALTER TABLE `tb_hazards_factor` DISABLE KEYS */;
INSERT INTO `tb_hazards_factor` VALUES (1,.......);
/*!40000 ALTER TABLE `tb_hazards_factor` ENABLE KEYS */;
UNLOCK TABLES;
- 还原
mysql -u root -h 10.88.99.9 -p --default-character-set=utf8 < backdb.sql