Home > Database > Mysql Tutorial > How to export mysql database table to excel

How to export mysql database table to excel

coldplay.xixi
Release: 2020-09-09 15:52:34
Original
9452 people have browsed it

How to export mysql database table to excel: First open [bestlovesky.xls] in text mode; then click [Save As], select ansi encoding in the encoding; and finally save it.

How to export mysql database table to excel

【Related learning recommendations: mysql tutorial(Video)】

How to export mysql database table to excel:

Method 1

Use mysql commands and shell

select * into outfile './bestlovesky.xls' from bestlovesky where 1 order by id desc limit 0, 50;
Copy after login

Method 2

Open bestlovesky.xls in text mode, then save it as, select ansi encoding in encoding, save

echo "select id,name from bestlovesky where 1 order by id desc limit 0, 50;"| /usr/local/mysql/bin/mysql -h127.0.0.1-uroot -p123456 > /data/bestlovesky.xls
Copy after login

Method 3

Use mysql command

mysql -uroot -p -e "select * from test.table2 " > d:a.xsl
Copy after login

If you want to learn more about programming, please pay attention to the php training column!

The above is the detailed content of How to export mysql database table to excel. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template