MySQL 节点#
¥MySQL node
使用 MySQL 节点实现 MySQL 中的自动化操作,并将 MySQL 与其他应用集成。n8n 内置支持多种 MySQL 功能,包括执行 SQL 查询,以及在数据库中插入和更新行。
¥Use the MySQL node to automate work in MySQL, and integrate MySQL with other applications. n8n has built-in support for a wide range of MySQL features, including executing an SQL query, as well as inserting, and updating rows in a database.
本页列出了 MySQL 节点支持的操作,并提供更多资源的链接。
¥On this page, you'll find a list of operations the MySQL node supports and links to more resources.
Credentials
请参阅 MySQL 凭据 以了解有关设置身份验证的指导。
¥Refer to MySQL credentials for guidance on setting up authentication.
This node can be used as an AI tool
This node can be used to enhance the capabilities of an AI agent. When used in this way, many parameters can be set automatically, or with information directed by AI - find out more in the AI tool parameters documentation.
操作#
¥Operations
- 删除
¥Delete
- 执行 SQL
¥Execute SQL
- 插入
¥Insert
- 插入或更新
¥Insert or Update
- 选择
¥Select
- 更新
¥Update
模板和示例#
¥Templates and examples
相关资源#
¥Related resources
有关服务的更多信息,请参阅 MySQL 连接器和 API 文档。
¥Refer to MySQL's Connectors and APIs documentation for more information about the service.
有关编写 SQL 查询的更多信息,请参阅 MySQL 的 SELECT 语句文档 文档。
¥Refer to MySQL's SELECT statement documentation for more information on writing SQL queries.
使用查询参数#
¥Use query parameters
创建要在 MySQL 数据库上运行的查询时,你可以使用“选项”部分中的“查询参数”字段将数据加载到查询中。n8n 对查询参数中的数据进行清理,以防止 SQL 注入。
¥When creating a query to run on a MySQL database, you can use the Query Parameters field in the Options section to load data into the query. n8n sanitizes data in query parameters, which prevents SQL injection.
例如,你想要根据电子邮件地址查找某人。给定以下输入数据:
¥For example, you want to find a person by their email address. Given the following input data:
1 2 3 4 5 6 7 8 9 10 11 12 | |
你可以编写如下查询:
¥You can write a query like:
1 | |
然后在“查询参数”中,提供要使用的字段值。你可以提供固定值或表达式。在此示例中,请使用表达式,以便节点可以依次从每个输入项中提取电子邮件地址:
¥Then in Query Parameters, provide the field values to use. You can provide fixed values or expressions. For this example, use expressions so the node can pull the email address from each input item in turn:
1 2 | |
常见问题#
¥Common issues
有关常见错误或问题以及建议的解决方法,请参阅 常见问题。
¥For common errors or issues and suggested resolution steps, refer to Common issues.