1615: Prepared statement needs to be re-prepared(预处理语句需要重新准备)
MySQL含义
服务器端预处理语句的执行被拒绝,因为其依赖的元数据(表/视图定义)发生变化后该语句已失效。必须重新准备该语句。
原因
语句准备后对底层表执行了 DDL(ALTER TABLE)、表被重新创建、元数据缓存已满并淘汰了该条目,或 table_definition_cache/table_open_cache 限制过小。在 DDL 频繁的系统以及某些 ORM/连接池场景中很常见。
解决方法
大多数客户端库会捕获此错误并自动重新准备语句;在应用中捕获此错误并重试 prepare + execute。如果频繁出现,增大 table_definition_cache 和 table_open_cache。避免在应用流量期间执行不必要的 DDL。
同一数据库的其他条目
- 1236Got fatal error 1236 from master when reading data from binary log(从 master 读取二进制日志数据时收到致命错误 1236)
- 1129Host 'host' is blocked because of many connection errors(主机 'host' 因连接错误过多而被阻止)
- 1194Table 'name' is marked as crashed and should be repaired(表 'name' 被标记为已崩溃,应当修复)
- 1553Cannot drop index needed in a foreign key constraint(无法删除外键约束所需的索引)
- 3948Loading local data is disabled; this must be enabled on both the client and server sides(加载本地数据已禁用;必须在客户端和服务器端同时启用)
- 1075Incorrect table definition; there can be only one auto column and it must be defined as a key(表定义不正确;只能有一个自增列,且必须将其定义为键)
- 1055Expression not in GROUP BY (only_full_group_by)(表达式不在 GROUP BY 中)