In the article Connect Data we have already introduced the steps for adding data sources. This article focuses on the specific settings for MySQL data sources.
In the data source editing window, select the** “Add New Data”** tab on the left side, and then click the “Mysql” option in the database category on the right side of the window.
The software will display a “Connect to Mysql” settings box. Fill in the basic parameters for the database you need to connect to, and click the “Connect” button. The software will automatically attempt to connect to the database and retrieve all the databases within it.
There are two modes for adding data: “Table/View” mode and “SQL” mode.
After clicking the “Connect” button, in “Table/View” mode, select the database name that contains the table you want to add. The software will list all the table names in that database in the box on the right side of the list. Check the tables you want to add and click “Confirm.”
The software will automatically load the data from the table and display it on the interface. After verifying everything is correct, click the “Confirm” button to successfully add the MySQL data source.
When connecting to the database, if you need to perform operations such as joins, field filtering, count filtering, or sorting on the tables, you can use SQL statements to achieve this. However, the SQL functionality is primarily suited for developers or those with a certain level of SQL knowledge.
For example: We have added a “shanhaibi” database and want to filter the sid and score fields from the student table in the “shanhaibi” database. To achieve this, we only need to add an SQL statement. Here are the specific steps:
After clicking the “Connect” button, click “+Add SQL Statement” in the “SQL” mode, enter the SQL statement “select sid, score from shanhaibi.score;”, and then click “Confirm.”
At this time, the software will automatically load the data from the data table and display it in the interface. After confirming there are no issues, click the “Confirm” button, and a MySQL data source is successfully added.
**Tip: **The data here only supports viewing and does not support online modification. If you need to modify the data, please modify it directly in the data source file. After modification, please follow the relevant tutorial to refresh the data.