In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article will explain in detail how to use mysqlimport to import data into mysql. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.
1. Prepare to import data
[root@D2-LZY245 ~] # cat / tmp/emp.txt
100,Steven,King,24000.00
101,Neena,Kochhar,17000.00
102,Lex,De Haan,17000.00
103,Alexander,Hunold,9000.00
104,Bruce,Ernst,6000.00
105,David,Austin,4800.00
106,Valli,Pataballa,4800.00
107,Diana,Lorentz,4200.00
108,Nancy,Greenberg,12008.00
109,Daniel,Faviet,9000.00
110,John,Chen,8200.00
2. Create InnoDB engine table
Mysql > create database test1
Query OK, 1 row affected (0.00 sec)
Mysql > use test1
Database changed
Mysql > create table emp (
-> employee_id int (10)
> first_name varchar (50)
> last_name varchar (50)
-> salary decimal (10jue 2) engine=innodb charset=utf8
Query OK, 0 rows affected (0.00 sec)
3. Import data
[root@D2-LZY245] # mysqlimport-uroot-pendant 123456' test1-- default-character-set=utf8-- fields-terminated-by=',' / tmp/emp.txt
Mysqlimport: [Warning] Using a password on the command line interface can be insecure.
Test1.emp: Records: 11 Deleted: 0 Skipped: 0 Warnings: 0
4. View the results
Mysql > select * from emp
+-+
| | employee_id | first_name | last_name | salary | |
+-+
| | 100 | Steven | King | 24000.00 | |
| | 101 | Neena | Kochhar | 17000.00 | |
| | 102 | Lex | De Haan | 17000.00 | |
| | 103 | Alexander | Hunold | 9000.00 | |
| | 104 | Bruce | Ernst | 6000.00 | |
| | 105 | David | Austin | 4800.00 | |
| | 106 | Valli | Pataballa | 4800.00 | |
| | 107 | Diana | Lorentz | 4200.00 | |
| | 108 | Nancy | Greenberg | 12008.00 | |
| | 109 | Daniel | Faviet | 9000.00 | |
| | 110 | John | Chen | 8200.00 | |
+-+
11 rows in set (0.00 sec)
This is the end of this article on "how to import data into mysql using mysqlimport". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it out for more people to see.
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.