mysql 导出数据无法倒入数据库

1.出现问题的 sql 文件

/*
Navicat MySQL Data Transfer

Source Server         : 20.0.1.118
Source Server Version : 50631
Source Host           : 20.0.1.118:3306
Source Database       : nslm

Target Server Type    : MYSQL
Target Server Version : 50631
File Encoding         : 65001

Date: 2016-11-25 16:16:40
*/

SET FOREIGN_KEY_CHECKS=0;

-- ----------------------------
-- Table structure for areas
-- ----------------------------
DROP TABLE IF EXISTS `areas`;
CREATE TABLE "areas" (
  "id" varchar(32) NOT NULL COMMENT '编号',
  "name" varchar(30) NOT NULL COMMENT '名称',
  "parent_id" varchar(32) NOT NULL,
  "code" varchar(2) NOT NULL COMMENT '完整编号',
  "level" tinyint(1) NOT NULL COMMENT '层级',
  "is_hide" tinyint(1) NOT NULL,
  "full_name" varchar(200) NOT NULL,
  PRIMARY KEY ("id"),
  KEY "index_area_parent_id" ("parent_id") USING BTREE,
  KEY "index_area_name" ("name") USING BTREE,
  KEY "INDEX_ID" ("id") USING BTREE
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of areas
-- ----------------------------
INSERT INTO `areas` VALUES ('01', '北京市', '0', '01', '1', '0', '北京市');
INSERT INTO `areas` VALUES ('0101', '北京市', '01', '01', '2', '0', '北京市北京市');
INSERT INTO `areas` VALUES ('010101', '东城区', '0101', '01', '3', '0', '北京市北京市东城区');

2.正常导入数据的 sql

/*
Navicat MySQL Data Transfer

Source Server         : localhost
Source Server Version : 50634
Source Host           : localhost:3306
Source Database       : nslm

Target Server Type    : MYSQL
Target Server Version : 50634
File Encoding         : 65001

Date: 2016-11-25 16:22:11
*/

SET FOREIGN_KEY_CHECKS=0;

-- ----------------------------
-- Table structure for areas
-- ----------------------------
DROP TABLE IF EXISTS `areas`;
CREATE TABLE `areas` (
  `id` varchar(32) NOT NULL COMMENT '编号',
  `name` varchar(30) NOT NULL COMMENT '名称',
  `parent_id` varchar(32) NOT NULL,
  `code` varchar(2) NOT NULL COMMENT '完整编号',
  `level` tinyint(1) NOT NULL COMMENT '层级',
  `is_hide` tinyint(1) NOT NULL,
  `full_name` varchar(200) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `index_area_parent_id` (`parent_id`) USING BTREE,
  KEY `index_area_name` (`name`) USING BTREE,
  KEY `INDEX_ID` (`id`) USING BTREE
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of areas
-- ----------------------------
INSERT INTO `areas` VALUES ('01', '北京市', '0', '01', '1', '0', '北京市');
INSERT INTO `areas` VALUES ('0101', '北京市', '01', '01', '2', '0', '北京市北京市');
INSERT INTO `areas` VALUES ('010101', '东城区', '0101', '01', '3', '0', '北京市北京市东城区');

3.差别:将所有【”】 替换为 【`】

 CREATE TABLE "areas" (
  "id" varchar(32) NOT NULL COMMENT '编号',

 CREATE TABLE `areas` (
  `id` varchar(32) NOT NULL COMMENT '编号',

很明显,第一个文件的建表语句中实用的是双引号,第二个实用的是【`】,这个不是单引号,而是~那个按键所在的下面的那个字符,所以把所有的双引号替换为【`】,结果可以正确的倒入数据了 。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值