In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces how to from the file load data to mysql, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.
Mysql parsing of files: columns are separated by spaces by default, and one row corresponds to one record
The format of the content in the file is as follows:
Load data infile'dappled into table ggg test.txt'
Columns can also be separated by',', and the column delimiter can be added to the sql statement.
The format of the content in the file is as follows:
Load data infile'dVUTERTER test.txt 'into table ggg FIELDS TERMINATED BY','
Continue:
When load has a large amount of data, mysql defaults to build indexes while building load, so it will be slow. You can turn off automatic indexing before load. The sql statement is: "alter table tbname disable keys;". After that, use "alter table tbname enable keys;", and mysql will supplement the creation of lost indexes.
2014-10-16 continued:
Today in load, the following error was reported:
Looking at this error, the first thing that comes to mind is that the file does not have the execution permission, but it is still not solved after modifying the file permission. Later, it is found that the reason is that the directory where the file is located does not have the execution permission.
The default read-write directory for performing show variables like'% tmpdir%'; visible mysql is / tmp
Solution: move the files you want to load to the / tmp directory!
Load data to the table, or you can specify a column, just add the column name after the indication, eg:
LOAD DATA LOCAL INFILE 'persondata.txt' INTO TABLE persondata (col1,col2); Thank you for reading this article carefully. I hope the article "how to File load data to mysql" shared by the editor is helpful to everyone. At the same time, I also hope you can support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.