mysql 导入大sql文件

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/qq331570870/article/details/72851950
1.打开cmd
2.进入到MySQL的bin文件夹  (C:\software\phpStudy\phpStudy\MySQL\bin)
如果是在mamp下,则打开终端(Terminal),输入
/Applications/MAMP/Library/bin/mysql -uroot -p
3.输入命令:mysql -u root -p
4.输入密码:root(MySQL的密码)
5.输入命令(采用souce方法导入):\. C:/software/phpStudy/phpStudy/MySQL/bin/a.sql(假设你的sql文件为a.sql,它放在bin文件夹下) 
展开阅读全文

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 问答

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