mysql source 命令导入大的sql文件的方法
程序员文章站
2023-12-20 22:11:34
在mysql的安装目录下 找到 my.ini文件 加入以下代码:interactive_timeout = 120wait_timeout = 120max_allowed...
在mysql的安装目录下 找到 my.ini文件 加入以下代码:
interactive_timeout = 120
wait_timeout = 120
max_allowed_packet = 32m
======================================
小例子
mytest_emp_dept.sql文件,内容如下:
create table emp(eid int primary key auto_increment, ename varchar(20) not null, esex varchar(10), deptid int not null);
create table dept(deptid int primary key auto_increment, dname varchar(20) not null,daddress varchar(200));
insert into emp(ename,esex,deptid) values('chris','m',1),('edge','m',1),('kelly','w',2),('maryse','w',2);
insert into dept(dname,daddress) values('development','beijing'),('accounting','shanghai');
select ename,esex,dname,daddress from emp,dept where emp.deptid=dept.deptid order by ename;
======================================
导入sql的命令行如下:
source "路径名"+/mytest_emp_dept.sql
======================================
效果如下:
interactive_timeout = 120
wait_timeout = 120
max_allowed_packet = 32m
======================================
小例子
mytest_emp_dept.sql文件,内容如下:
create table emp(eid int primary key auto_increment, ename varchar(20) not null, esex varchar(10), deptid int not null);
create table dept(deptid int primary key auto_increment, dname varchar(20) not null,daddress varchar(200));
insert into emp(ename,esex,deptid) values('chris','m',1),('edge','m',1),('kelly','w',2),('maryse','w',2);
insert into dept(dname,daddress) values('development','beijing'),('accounting','shanghai');
select ename,esex,dname,daddress from emp,dept where emp.deptid=dept.deptid order by ename;
======================================
导入sql的命令行如下:
source "路径名"+/mytest_emp_dept.sql
======================================
效果如下: