The MySQL load method must be built in case the MySQL service allows the command to be used:How to open the command:1. Add a row local-infile=1 (the default appears to be on) to the MY.CNF (Windows My.ini) for the instance , and switch to 0 to OFF,
This is the official manual for mariadb: The translation of LOAD DATA infile.Original:https://mariadb.com/kb/en/load-data-infile/I submit it to MARIADB official manual:https://mariadb.com/kb/zh-cn/load-data-infile/Back to Linux series article
LOAD DATA [low_priority] [LOCAL] INFILE ' file_name.txt ' [REPLACE | IGNORE]Into TABLE tbl_name[Fields[TERMINATED by ' \ t '][Optionally] Enclosed by "][escaped by ' \ \ '][LINES TERMINATED by ' \ n '][IGNORE number LINES][(Col_name,...)]Custom
Importing a database because the file is too large and the file format is not a standard SQL file cannot be imported using sourceCSDN data format is: User name # password # mailbox data is separated by #The import SQL statement is as follows:
When using MySQL, the load data infile is often used to import, and sometimes a format conversion problem is encountered when a column of type date is encountered:First create a simple people table with name, birthday, age three fields:mysql> create
Basic Syntax:
Load data [low_priority] [local] infile 'file _ name txt '[replace | ignore]Into table tbl_name[Fields[Terminated by 'T'][OPTIONALLY] enclosed by ''][Escaped by ''][Lines terminated by 'n'][Ignore number lines][(Col_name,)] The load
Pilot out dataMysql> SELECT * from Timer_gps_posinfo where time> ' 2017-01-01 00:00 ' and Time Error:ERROR 1290 (HY000): The MySQL server is running with the--SECURE-FILE-PRIV option so it cannot execute this statementSolution: Two methods1.
Basic syntax:
Load data [low_priority] [local] infile ' file_name txt ' [replace | ignore]into table Tbl_name[Fields[Terminated by ' t '][optionally] enclosed by '][escaped by ']][Lines terminated by ' n '][Ignore number lines][(Col_name,)]The load
Let's take a look at the MySQL Load data InFile outfile Import Export Oh, this is the way we run the Windows Cmd.exe and then use the following statement in the DOS command method.
Load Data InFile The opposite isSelect * from ' tabletest ' into
If:CREATE TABLE test_table (ID int, name varchar (128);If the order is as follows:Load data infile ' a.txt ' into table ' test_table ' fields enclosed by ' "' terminated by ', 'If the column values are as follows:"1", "ABC" 123 "ABC"Such a value can
Select INTO outfile usageIn MySQL, you can use SELECT ... The into OUTFILE statement exports the contents of the table as a text file.SELECT [column name] FROM table [WHERE statement] into OUTFILE ' target file ' [OPTION]; The "option"
First create a table
Use test;
Create Table tabletest (
'Id' mediumint (8) default '0 ',
'Name' varchar (100) default''
) Type = MyISAM;
Import data to a data tableLoad data infile 'C:/data.txt 'into Table 'tabletest'
Commonly used:Load
For example, I now have a table, the field has a, B, C, d four, the load data TXT file contains only 3 fields (A, B, c) values, while importing, I can set a value for each record's D field? (such as the user name of the operation, etc.)
The use of the following methods:
The code is as follows
Copy Code
Mysql>load data local infile "d:/ab.txt" into table Mytbl (name,age);
How to load data with back slash (backslash) "" data
Because if you do
20 times times faster than insert. Share Java program operations.Package Com.mysql.csv;import Java.sql.connection;import Java.sql.drivermanager;import java.sql.PreparedStatement; Import Java.sql.sqlexception;public class Competition {static
The LOAD DATA infile statement reads from a text file into a table at a high speed. If you specify a local keyword, read the file from the client host. If local is not specified, the file must be located on the server. (Local is available in MySQL3.2
Use bitsCN.com for mysqlloaddatainfile
Load data [LOW_PRIORITY | CONCURRENT] [LOCAL] INFILE 'file_name.txt'
[REPLACE | IGNORE]
Into table tbl_name
[FIELDS
[Terminated by 'string']
[[OPTIONALLY] enclosed by 'char ']
[Escaped by 'char
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.