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

How to export mysql database table to excel

coldplay.xixi
coldplay.xixiOriginal
2020-09-03 13:23:289484browse

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;

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

Method 3

Use mysql command

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

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!

Statement:
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

Related articles

See more