Refer to the official document http://dev.mysql.com/doc/refman/5.7/en/select-into.html mysql> select game,domain,type -> into outfile 'd:\\game.csv' -> fields terminated by ',' -> lines terminated by '\n' -> from game_lists limit 10; The following are examples: mysql> create table test(id int(10) not null auto_increment primary key, name varchar(10) not null, age tinyint(2) not null)engine=innodb default charset=utf8; mysql> insert into test(`name`,`age`) values ('Lee',20),('Li',30),('Wang',22),('Feng',23); Check the results first mysql> select * from (select 'name','age' union select name,age from test) b; +------+-----+ | name | age | +------+-----+ | name | age | | Lee | 20 | | Li | 30 | | Wang | 22 | | Feng | 23 | +------+-----+ 5 rows in set (0.00 sec) Export CSV file mysql> select * into outfile 'd:\\tmp\\columns.csv' fields terminated by ',' lines terminated by '\n' from (select 'name','age' union select name,age from test) b; Query OK, 5 rows affected (0.00 sec) The above method of exporting MySQL CSV files with headers is all I have to share with you. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM. You may also be interested in:
|
<<: Alibaba Cloud Server Ubuntu Configuration Tutorial
>>: Let’s take a look at JavaScript precompilation (summary)
This article shares the specific code of writing ...
one, G:\MySQL\MySQL Server 5.7\bin> mysqld --i...
As shown below: from table where condition group ...
Let me first introduce to you that the node proce...
Grayscale release refers to a release method that...
Table of contents Overview 1. Acquisition and pro...
Preface Today, when I was using a self-written co...
Use CSS styles and HTML tag elements In order to ...
<br /> Note: All texts, except those indicat...
background When we talk about transactions, every...
1. Percentage basis for element width/height/padd...
Frameset pages are somewhat different from ordina...
Because we were going to build a website, in addi...
Table of contents 01. Listener watch (1) Function...
Table of contents 1. New II. Modification element...