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.
【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!