You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何解决:MySQL ODBC 5.3(w)驱动每小时连接数超限问题

Hey there, let's work through this MySQL connection limit error you're seeing with Excel's MS Query. The error message you're hitting is:

连接失败 [MySQL][ODBC 5.3(w) Driver]用户'ODBC'已超出每小时最大连接数限制。

This means the MySQL user ODBC has a per-hour connection quota that's been fully used up. Since this didn't happen before, let's break down the fixes and root cause checks to get you back on track:

1. 临时恢复连接权限(紧急解决)

First, let's get your Excel queries working again right away. You'll need access to a MySQL admin account (like root) to run this command:

ALTER USER 'ODBC'@'your_host' WITH MAX_CONNECTIONS_PER_HOUR 0;
  • Replace your_host with the actual host linked to the ODBC user (it might be % for any host, or a specific IP you can look up in MySQL's user table).
  • Setting 0 removes the hourly connection limit entirely, so you can resume work immediately.
2. 排查 why 连接数突然超标

Since this issue is new, something changed recently. Here are key things to check:

  • Excel refresh settings: Did you set up automatic refresh for your queries? If multiple worksheets are refreshing every few minutes, each refresh might create a new connection that adds to the hourly count.
  • ODBC Connection Pooling: Open your ODBC Data Source Administrator, find your MySQL DSN, and check the connection pool settings. If pooling is enabled but misconfigured, connections might not release properly, leading to a buildup.
  • Excel macros/automation: Are there any macros running repeated queries without closing connections? Make sure your macros explicitly close connections after they finish using them.
3. 永久调整连接限制(如果需要)

If you want to keep a limit but raise it to fit your usage, run this as a MySQL admin:

ALTER USER 'ODBC'@'your_host' WITH MAX_CONNECTIONS_PER_HOUR 1000; -- Adjust the number to match your actual needs

To make this setting stick even after MySQL restarts, update the user's permanent privileges:

GRANT USAGE ON *.* TO 'ODBC'@'your_host' WITH MAX_CONNECTIONS_PER_HOUR 1000;

After making these changes, restart your MySQL service to ensure everything takes effect.

4. 优化 Excel 查询的连接使用

To prevent this from happening again, tweak how Excel uses connections:

  • Reuse connections: Instead of creating a new connection for each worksheet, share the same connection across multiple queries.
  • Close idle connections: In Excel's "Data" tab, go to "Connections" and shut down any idle connections you don't actively need.
  • Batch queries: Combine small, repeated queries into a single query where possible—this cuts down on the number of new connections being created.

内容的提问来源于stack exchange,提问作者Vorlon

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 08:32:27