Excel data and MySql data conversion _ MySQL

Source: Internet
Author: User
Step 1 of Excel data and MySql data conversion:

Select the data to be imported and add one more column,

Step 2:

Copy the selected data to a new table, and then save it as a text file (tab Division) (*. txt ).Ta.txt.

Step 3:

Create a MySql database and table based on the data to be imported, and then use the command

Load daTa local infile 'd: daTa.txt 'into table exceltomysql fields terminated by't ';

Import.

Now all the data has been imported into MySql,

Let's select it,

By now, the data has been converted from Excel to MySql.

Next, the process of converting data from MySql to Excel is actually a text file separated by a tab.

If you want to import the boy information in this table to Excel, you can.

Select * into outfile 'd: man.txt 'from exceltomysql where xingbie = "male ";

In this way, all boys' information in the table is output to the text file D: man.txt separated by tabs and ended with 'n.

You can open the Excel file, select "data"> "import external data"> "import data", select "D: man.txt", and click OK.

Well, we have passed this method, but the feasibility is acceptable, but we still encounter a problem, that is, when we import data with Chinese characters, the field in the database cannot be displayed, A little garbled, but many of them are empty. I don't know why. the attribute of the field is varchar. that's right. so this problem is not solved, so we have to change it again !!! Thank you for your advice !!!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.