MY sql
Backup:
mysqldump -h ${DBSERVER} --single-transaction -u ${DBUSER} -p${DBPASSWD} ${DBNAME} | gzip > ${DB_BACKUP_PATH}/${DBNAME}/${DBNAME}_${BACKUP_TIME}.sql.gz
Restore:
gunzip gzip > ${DB_BACKUP_PATH}/${DBNAME}/${DBNAME}_${BACKUP_TIME}.sql.gz | mysql -u ${DBUSER} -p${DBPASSWD} ${DBNAME}
禁用外键约束
SET FOREIGN_KEY_CHECKS=0;
启动外键约束
SET FOREIGN_KEY_CHECKS=1;
查看当前FOREIGN_KEY_CHECKS的值可用如下命令
SELECT @@FOREIGN_KEY_CHECKS;