Home  >  Article  >  Backend Development  >  Implementation code for importing Excel data into Mysql database_PHP tutorial

Implementation code for importing Excel data into Mysql database_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:52:24734browse



First, let me explain why I use Navicat. The first reason is because it is a good Mysql GUI tool. More importantly, it can import some external data sources into the Mysql database. Because my data source is excel data, I want to use Navicat to import it into Mysql.

When running for the first time, first create a connection, fill in the host name: localhost, the port is 3306, then fill in the username and password, OK. If everything goes well, everyone will see the connection icon named localhost. Double-click it to open it. Generally, Mysql has two databases by default, namely mysql and test.

Don’t worry about them, right-click localhost and choose to create a new database. I filled in the infosystem here. You can modify the name as needed. Pay attention to the option to select the character set next. If your data source has Chinese, then It is best to choose gb2312 and select gb2312_chinese_ci for sorting. This can ensure that the data can be displayed correctly in the database and avoid the occurrence of Chinese garbled characters.

Select the infosystem database you just created, click the Import Wizard button on the upper right side of the navicat form to enter the import wizard, and then follow the wizard step by step to configure:

The type is Excel file
Select The specific location of the excel file you want to import and a certain table in excel
Configure the table structure
Start importing
That’s it, very simple, the original data in excel is imported into the Mysql database. At this time, you can see a new table just imported in the systeminfo database. Open it to see if it is displayed correctly. At this point, the data source has been determined.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/318967.htmlTechArticleFirst of all, let me explain why I use Navicat. The first reason is because it is a good MysqlGUI tool. What's more, it can import some external data sources into Mysql database...
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