MySQL source imports multiple SQL files and large files and online mutual transfer

Source: Internet
Author: User

mysql>use dbtest;
mysql>set names UTF8;

Mysql>source D:/mysql/all.sql;

To import multiple files through the source command, you can create a new All.sql file that contains the following command
For example:
source D:/a1.sql;
source D:/a2.sql;
When you run
Mysql>source D:/mysql/all.sql;
This allows you to import multiple SQL files within a single source command.

I see people still try to use source *.sql to execute, this is not possible (elder brother also tried a bit).
It is worth noting that the All.sql loaded SQL file is best written in absolute path, otherwise the file will not be found unless you are in the. SQL sibling directory enabled under MySQL


This allows you to import multiple SQL files within a single source command.

But this will have a problem, if there are 1100 such files we go to write a command must be very troublesome, the following I Baidu search for a solution

<pre name= "code" class= "Python" >
<span style= "FONT-SIZE:18PX;" > Create a new All.sqlvim all.sql inside write: source 1.sqlsource 2.sql......source 53.sqlsource 54.sql then just mysql> source All.sql </span>


</pre ><p><span style= "Color:rgb (68, 68, 68); Font-family:simsun; font-size:14px; line-height:26px; " > Another large file import solution, this is a user with server administration privileges </span></p><p><span style= "Color:rgb (68, 68, 68); Font-family:simsun; font-size:14px; line-height:26px; " ><span style= "Color:rgb (68, 68, 68); Font-family:simsun; font-size:14px; line-height:26px; " > Locate the My.ini file in the MySQL installation directory by adding the following code: </span></span></p><p><span style= "Color:rgb (68, 68, 68); Font-family:simsun; font-size:14px; line-height:26px; " ><span style= "Color:rgb (68, 68, 68); Font-family:simsun; font-size:14px; line-height:26px; " ></span></span><pre name= "code" class= "html" >interactive_timeout = 120wait_timeout = 120max_ Allowed_packet = 32M 
the command line to import SQL is as follows:

SOURCE "path name" +/mytest_emp_dept.sql

If two of the online sites transfer data, the solution is simpler:
mysqldump  -uuser -ppwd database | mysql -hip -ppwd database
*user for database user name PWD for database password, IP for database ip;database database name, and later for Target library *



MySQL source imports multiple SQL files and large files and online mutual transfer

Related Article

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.