Navicatformysql在WIN10下导⼊SQL不成功解决办法
最近在学习数据库知识,从书上到⼀个sql脚本,⽤nivacat for mysql导⼊的时候,总是报错不成功,有时⼜能导⼊⼏个⽂件,虽然出错。百度⼀下也没办法解决。经过⼀段时间研究,估计是软件有些问题,因为我是64位WIN10,最后没办法,将能导⼊的⼏个⽂件(表)备份为⼀个SQL脚本,然后再导⼊则正常。
这样我看到⼀些希望,我将这个脚本与原脚本⽐较,发现在语⾔结构上有差别,如下,
原脚本语⾔:
/*
MySQL Data Transfer
Source Host: localhost
Source Database: orderdish
Target Host: localhost
Target Database: orderdish
Date: 2013/1/21 15:45:48
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for authority
-- ----------------------------
DROP TABLE IF EXISTS `authority`;
CREATE TABLE `authority` (
`authority_id` char(10) NOT NULL,
`authority_name` varchar(20) NOT NULL,
PRIMARY KEY  (`authority_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for authority_role
-- ----------------------------
DROP TABLE IF EXISTS `authority_role`;
CREATE TABLE `authority_role` (
`role_id` char(10) default NULL,
mysql下载安装教程 win10 64位`authority_id` char(10) default NULL,
KEY `fk_role_ar` (`role_id`),
KEY `fk_authority` (`authority_id`),
CONSTRAINT `fk_authority` FOREIGN KEY (`authority_id`) REFERENCES `authority` (`authority_id`),
CONSTRAINT `fk_role_ar` FOREIGN KEY (`role_id`) REFERENCES `role` (`role_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
。。。。。。。。。
-- ----------------------------
-- Records
-- ----------------------------
INSERT INTO `authority` VALUES ('001', '登陆');
INSERT INTO `authority` VALUES ('002', '修改');
INSERT INTO `authority` VALUES ('003', '查询');
INSERT INTO `authority` VALUES ('004', '删除');
INSERT INTO `authority` VALUES ('007', '上菜');
INSERT INTO `authority` VALUES ('008', '添加');
INSERT INTO `authority_role` VALUES ('001', '001');
能导⼊ 脚本语⾔如下:
/*
Navicat MySQL Data Transfer
Source Server        : BNKJ
Source Server Version : 50719
Source Host          : localhost:3306
Source Database      : orderdish
Target Server Type    : MYSQL
Target Server Version : 50719
File Encoding        : 65001
Date: 2017-10-07 03:45:19
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for authority
-- ----------------------------
DROP TABLE IF EXISTS `authority`;
CREATE TABLE `authority` (
`authority_id` char(10) NOT NULL,
`authority_name` varchar(20) NOT NULL,
PRIMARY KEY  (`authority_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of authority
-- ----------------------------
INSERT INTO `authority` VALUES ('001', '登陆');
INSERT INTO `authority` VALUES ('002', '修改');
INSERT INTO `authority` VALUES ('003', '查询');
INSERT INTO `authority` VALUES ('004', '删除');
INSERT INTO `authority` VALUES ('007', '上菜');
INSERT INTO `authority` VALUES ('008', '添加');
-- ----------------------------
-- Table structure for authority_role
-- ----------------------------
DROP TABLE IF EXISTS `authority_role`;
CREATE TABLE `authority_role` (
`role_id` char(10) default NULL,
`authority_id` char(10) default NULL,
KEY `fk_role_ar` (`role_id`),
KEY `fk_authority` (`authority_id`),
CONSTRAINT `fk_authority` FOREIGN KEY (`authority_id`) REFERENCES `authority` (`authority_id
`),  CONSTRAINT `fk_role_ar` FOREIGN KEY (`role_id`) REFERENCES `role` (`role_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of authority_role
-- ----------------------------
INSERT INTO `authority_role` VALUES ('001', '001');
-- ----------------------------
-- Table structure for category
-- ----------------------------
DROP TABLE IF EXISTS `category`;
CREATE TABLE `category` (
`cate_id` char(10) NOT NULL,
`cate_name` varchar(30) NOT NULL,
`cate_delflag` char(1) default '0',
`cate_createtime` datetime default NULL,
`cate_updatetime` datetime default NULL,
`mcate_id` char(10) default NULL,
PRIMARY KEY  (`cate_id`),
KEY `fk_mcate_cate` (`mcate_id`),
CONSTRAINT `fk_mcate_cate` FOREIGN KEY (`mcate_id`) REFERENCES `maincategory` (`mcate_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of category
-- ----------------------------
-- ----------------------------
-- Table structure for countunit
-- ----------------------------
DROP TABLE IF EXISTS `countunit`;
CREATE TABLE `countunit` (
`unit_id` char(10) NOT NULL,
`unit_name` varchar(30) NOT NULL,
`unit_remark` varchar(60) default NULL,
`unit_delflg` char(1) default '0',
PRIMARY KEY  (`unit_id`)
)
ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of countunit
-- ----------------------------
可以看到每个表格完成后会⽤
-- ----------------------------
-- Records of countunit
-- ----------------------------
这段语句来结束,
插⼊初始数据不是放在最后,⽽在在每⼀个表格结束后,下⼀个表格开始前,如下 :
-- ----------------------------
-
- Records of authority
-- ----------------------------
INSERT INTO `authority` VALUES ('001', '登陆');
INSERT INTO `authority` VALUES ('002', '修改');
INSERT INTO `authority` VALUES ('003', '查询');
INSERT INTO `authority` VALUES ('004', '删除');
INSERT INTO `authority` VALUES ('007', '上菜');
INSERT INTO `authority` VALUES ('008', '添加');
为此,将原表格按新表格更改保存。
再次导⼊,发现没有错误了,⼀阵欢呼。。。
可再看,却只有⼀个表格,这个数据库有18个表格呀!
继续研究。。
发现将改好的脚本直接拖到数据库名与表的共同的两个节点(荧光笔涂抹处对话框0),弹出是⼀个对话框1,如下: 这样导⼊虽然没错,却只有⼀个表格,不是我想要的表格。
如果我将脚本拖到只有数据库根节点(不包括表),弹出以下对话框2,
这时按步骤完成则导⼊成功,18个表格终于出来了,
成功了,⾃⼰⼜解决了⼀个难题,⼼⾥别提多⾼兴了
为⾃⼰加油,⾃⼰是最棒的!!
后来发现在CMD命令下打开,再⽤Navicat for MySQL也可以。
造成上述打开MYSQL出错的原因主要是版本不对
后来发现⽤mysql⾃带的mysqlworkbench导⼊即可,更简单。

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。