> For the complete documentation index, see [llms.txt](https://doc.duaer.com/zh/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.duaer.com/zh/integrations/builtin/app-nodes/duaer-nodes-base.mysql/common-issues.md).

# Duaer 里 MySQL 的常见问题

Duaer 里 MySQL 节点的常见问题：按组合键更新、Docker 连接、小数变成字符串。
## 按组合键更新 <a href="#update-rows-by-composite-key" id="update-rows-by-composite-key"></a>

Update 只能按一个 Column to Match On 匹配。需要多列才能确定一行时，改用 Execute SQL 自己写：

```
UPDATE orders SET quantity = 3 WHERE customer_id = 538 AND product_id = 800;
```

## Docker 里连不上本机 MySQL <a href="#cant-connect-to-a-local-mysql-server-when-using-docker" id="cant-connect-to-a-local-mysql-server-when-using-docker"></a>

Docker 里每个容器都有自己的 localhost。按部署方式改 MySQL 凭证的 Host：

- 只有 MySQL 在容器里：启动时映射端口（-p 3306:3306），Host 用 localhost。
- 只有 Duaer 在容器里：让 MySQL 监听 0.0.0.0，Host 用 host.docker.internal。Linux 上启动 Duaer 容器时加 --add-host host.docker.internal:host-gateway。
- 两者在不同容器里：放进同一个 Docker 网络，Host 用 MySQL 的容器名，例如 my-mysql。
- 两者在同一个容器里：Host 直接用 localhost。

## 小数返回成字符串 <a href="#decimal-numbers-returned-as-strings" id="decimal-numbers-returned-as-strings"></a>

为避免精度丢失，DECIMAL 默认以字符串返回。能接受精度风险时，在 Options 里打开 Output Decimals as Numbers；或在后面用 Edit Fields (Set) 转换。
## Questions

### Duaer 的 MySQL 节点为什么把小数返回成字符串？

为避免精度丢失。在 Duaer MySQL 节点的 Options 里打开 Output Decimals as Numbers 可改成数字。

