How to import large SQL files using the mysql source command

Source: Internet
Author: User
Tags dname

Find the my. ini file in the mysql installation directory and add the following code:
Interactive_timeout = 120
Wait_timeout = 120
Max_allowed_packet = 32 M
==============================================
Small Example
The mytest_emp_dept. SQL file contains the following content:
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'), ('account', 'shanghai ');
SELECT ename, esex, dname, daddress FROM emp, dept WHERE emp. deptid = dept. deptid order by ename;
==============================================
The command line for importing SQL statements is as follows:
Source "pathname" +/mytest_emp_dept. SQL
==============================================
The effect is as follows:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.