MySQL Tutorial Import Excel method
The simplest way is to use the PHP tutorial myadmin directly import xls file on it, this is not much said below to see about PHP with the command of MySQL and shell combination of two methods.
Method One:
SELECT * into outfile './zhutiai.xls ' from Zhutiai where 1 the ORDER by id DESC limit 0, 50;
Method Two:
echo "Select Id,name from Zhutiai where 1 order by id DESC limit 0, 50;" | /usr/local/mysql/bin/mysql-h127.0.0.1-uroot-p123456 >/data/zhutiai.xls
Because office defaults to gb2312 encoding, server-side generated is likely to be utf-8 encoding, may lead to the export of Chinese garbled, the solution is as follows:
Method 1. Using Iconv on the server side for encoding conversion
Iconv-futf8-tgb2312-ozhutiai2.xls Zhutiai.xls
Method 2. Open Zhutiai.xls as text, then save As, select ANSI encoding in encoding, save
If Method 1 conversion is not smooth, you will be prompted: Iconv:illegal input sequence at position 1841 is similar to this error.
First download the Zhutiai.xls down, this time the file is Utf-8 encoded, with Excel open, garbled.
Open Zhutiai.xls as text, then save As, select ANSI encoding in encoding, save