Method: 1. Use navicat to create a new data table, and pay attention to the columns corresponding to the txt data; 2. Right-click the table and select the import wizard; 3. Select "txt" as the import type; 4. Select the path to the import file. Select UTF-8 for encoding; 5. Select the delimiter and the import mode is "Add.."; 7. Click to start importing and wait for the import to complete.
(Recommended tutorial: mysql video tutorial)
Sometimes when we use mysql database, we want to import txt text document, how to operate it? The following article will introduce to you how to import txt text data into mysql.
Prerequisites:
Install mysql and navicat
Mysql method of importing txt text data
The first step is to use navicat to open mysql on our computer, create a new database and a table, the fields designed in the table need to correspond to the number of columns of the imported text document, which field corresponds to which column of the txt text document, as shown in the figure below Display:
After creating the table in the second step, right-click the table and select the Import Wizard, as shown in the following figure:
The third step is to enter the import wizard interface, select the format of the imported text file .txt, and click Next, as shown below:
The fourth step is to select The path of the txt text document to be imported, select utf-8 for encoding, and click Next, as shown in the figure below:
The fifth step is to select the delimiter, which means press Use commas, semicolons or spaces to distinguish each column of the text document. The choice here is to distinguish by spaces. Click Next, as shown below:
##Step 6 Select which row the list title is and which row the first data row is. Select 1 here and click Next, as shown below: Step 7 Default Click Next. The source table here refers to the txt text document, and the target table is the database table to import data, as shown in the figure below: The eighth step will be by default To display the fields of the database table, you need to select the corresponding column from the source field, which is the txt text document. After selecting, click Next, as shown in the following figure: The ninth step selects the import mode, select Add: add records to the target table, click Next, as shown below: The tenth step is to import. The last step of the txt text document, click to start importing, wait for a while and the import is completed, click Close, open the database table, you can see that the txt text document data has been imported, as shown in the following figure:The above is the detailed content of How to import text data in mysql?. For more information, please follow other related articles on the PHP Chinese website!