Home  >  Article  >  Database  >  How to import Excel data into Mysql database

How to import Excel data into Mysql database

黄舟
黄舟Original
2017-08-04 15:08:511647browse

In many companies, especially those that are a little older, all forms in the financial business department are made using Excel. With the development of the Internet, various business processes have become electronic and streamlined, and they are stored in numerous documents. Finding reports for a certain year and month is quite tedious, so we are trying to find ways to directly import previous data into modern intelligent office programs. Many junior programmers may be a little confused here. Let’s introduce it below. Here is my little experience, I hope it can be helpful to everyone!

First of all, let me explain why I want to 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.

1. Step 1: Open Navicat first and create a connection to the database.

How to import Excel data into Mysql database

2. Enter the connection address, local is localhost, database name, generally the default is root, the port number of mysql is the default It is 3306. If the password is available, fill it in. If not, leave it blank.

How to import Excel data into Mysql database

3. If the previous step is successful, 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 these two libraries. If you have a library you want to import, you will definitely be able to see your library. Just double-click to open your library. I will create a new library and temporarily name it demo. You can choose any name you want. , what needs to be noted here is the character set, which programmers generally call encoding format. If there is Chinese in your excel, it is best to choose gb2312

How to import Excel data into Mysql database

4. After organizing these, 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

How to import Excel data into Mysql database

##5. Select the Excel file as the type

How to import Excel data into Mysql database

6. Select the file you want to import The specific location of the excel file and a certain table in excel, configure the table structure

How to import Excel data into Mysql database


##7. Click to start the import. At this point, the data originally in excel can be simply imported into the database. Check the database demo again to see if your excel table already exists. , the specific table structure must be set up, not only for smooth import, but also for simplicity and convenience when the later program calls the data of this database.

Instructions

Note: If there is Chinese in excel, the character set must be selected gb2312. Otherwise, garbled characters will appear and cannot be viewed. data.

Emphasis: It is best to design the table structure when importing, so as to facilitate the import and later use of the library.

The above is the detailed content of How to import Excel data into Mysql database. 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