Mysqlsource imports Multiple SQL files and large files and performs online Conversion

Source: Internet
Author: User
Mysqlusedbtest; mysqlsetnamesutf8; mysqlsourceD: mysqlall. SQL; you can use the source command to import multiple files and create a new all. SQL file, which stores the following commands: sourced: a1. SQL; sourced: a2. SQL; when you run mysqlsourceD: mysqlall. SQL; in this way, you can

Mysqluse dbtest; mysqlset names utf8; mysqlsource D:/mysql/all. SQL; you can use the source command to import multiple files and create a new all. SQL file, which stores the following commands: source d:/a1. SQL; source d:/a2. SQL; when you run mysqlsource D:/mysql/all. SQL; in this way, you can

Mysql> use dbtest;
Mysql> set names utf8;

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

Use the source command to import multiple files. You can create a new all. SQL file, which stores the following command
For example:
Source d:/a1. SQL;
Source d:/a2. SQL;
When you run
Mysql> source D:/mysql/all. SQL;
In this way, you can import Multiple SQL files in a source command.

I can see that some people try to use source *. SQL for execution. This is not acceptable (brother also tried it ).
It is worth noting that it is best to write an absolute path to the SQL file loaded by all. SQL. Otherwise, the file cannot be found unless you enable mysql under the same directory of. SQL.


In this way, you can import Multiple SQL files in a source command.

However, there will be a problem. If there are 100 such files, it will be very troublesome for us to write commands one by one. Below I found a solution by Baidu.

Create an all. sqlvim all. SQL file and write: source 1. sqlsource 2. SQL... source 53. sqlsource 54. SQL. Then, just mysql> source all. SQL


Another solution for importing large files is to use the server to manage permissions.

Find the my. ini file in the mysql installation directory and add the following code:

interactive_timeout = 120wait_timeout = 120max_allowed_packet = 32M
The command line for importing SQL statements is as follows:

Source "pathname" +/mytest_emp_dept. SQL

If two online websites exchange data, the solution is simpler:
Mysqldump-uuser-ppwd database | mysql-hip-ppwd database
* User is the database user name, pwd is the database Password, ip is the database ip, database is the database name, and the target database is later *



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.