MySql导入大sql文件

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/dmw412724/article/details/88555305

最简单的是直接使用mysql命令控制台,也是最快的.

mysql>source F:\insert.sql

但是这里有个情况,就是mysql默认设置的max_allowed_packet是1M.也就是说传输最多字节就是1048576

那么如果sql文件比较大,超出了1M,则会报错:MySQL server has gone away

这里需要将接受数据设置大些:

SET GLOBAL max_allowed_packet=268435456;

设置为256M

 

展开阅读全文

mysql导入.sql文件的问题

09-16

将一个.sql文件编辑,文本中最后加入下面这段代码(部分代码)后,导入这个sql文件就会报错(这段新加代码未能导入)rn原因是什么?还有就是应该如何解决这个问题。多谢了!rnrn```rn #rn# Function "fun_getChildList"rn#rnrnDROP FUNCTION IF EXISTS `fun_getChildList`;rnCREATE FUNCTION `fun_getChildList`(`type` int,`areaid` int,`orgid` int) RETURNS varchar(1000) CHARSET utf8rnBEGINrn rn rn DECLARE sTemp VARCHAR(1000);rn DECLARE xh VARCHAR(50);rn DECLARE areacode VARCHAR(100);rn DECLARE cunt INT;rn rn SELECT CONCAT(ORGXH,'%') INTO xh from ss_organization where ID_ORG=orgid;rn IF type=1 THENrn set sTemp='$';rn SELECT CONCAT(sTemp,',',GROUP_CONCAT(ID_ORG)) INTO sTemp from ss_organization where ORGXH like xh;rn ELSEIF type=0 THENrn SELECT COUNT(1) into cunt FROM ss_organization where ss_organization.ID_ORG=orgid and ss_organization.ORG_DISTRPARENTID=areaid;rn if cunt>0 thenrn select area_code INTO areacode from bs_distrarea_info where area_id=areaid;rn SELECT IFNULL(GROUP_CONCAT(ID_ORG),'0') into sTemp from ss_organization rn LEFT JOIN bs_distrarea_info ON ORG_DISTRPARENTID=area_id where area_code like CONCAT(areacode,'%') and area_id<>areaid;rn SELECT CONCAT(sTemp,',',IFNULL(GROUP_CONCAT(ID_ORG),'0')) INTO sTemp from ss_organization where ORGXH like xh;rn ELSEIF cunt=0 THENrn SELECT IFNULL(GROUP_CONCAT(ID_ORG),'0') into sTemp from ss_organization where ss_organization.ORG_DISTRPARENTID=areaid;rn end IF;rn SET sTemp=CONCAT('$',',',sTemp);rn END IF;rn RETURN sTemp;rnEND;rnrn#rn# Function "fun_getOrgLine"rn#rnrnDROP FUNCTION IF EXISTS `fun_getOrgLine`;rnCREATE FUNCTION `fun_getOrgLine`(`orgid` int) RETURNS varchar(1000) CHARSET utf8rnBEGINrn rn DECLARE sTemp VARCHAR(1000);rn DECLARE sTempChd VARCHAR(1000);rn DECLARE grade INT;rn DECLARE enterprisename VARCHAR(100);rn DECLARE st INT;rn rn SELECT ss_organization.ORG_GRADE,ss_organization.ENTERPRISE_NAME into grade,enterprisename from ss_organization where ss_organization.ID_ORG=orgid;rn SET st=1;rn WHILE grade<=st DOrn set st=st+1;rn END WHILE;rnrn RETURN grade;rnEND;rnrn#rn# Function "getChildLst"rn#rnrnDROP FUNCTION IF EXISTS `getChildLst`;rnCREATE FUNCTION `getChildLst`(rootId INT) RETURNS varchar(1000) CHARSET utf8rnBEGINrn DECLARE sTemp VARCHAR(1000);rn DECLARE sTempChd VARCHAR(1000);rn rn SET sTemp = '$';rn SET sTempChd =cast(rootId as CHAR);rn rn WHILE sTempChd is not null DOrn SET sTemp = concat(sTemp,',',sTempChd);rn SELECT group_concat(o.ID_ORG) INTO sTempChd FROM ss_organization o where FIND_IN_SET(o.ORG_PARENT_ID,sTempChd)>0;rn END WHILE;rn RETURN sTemp;rnEND;rnrnrnrn```rnrn 问答

没有更多推荐了,返回首页