MySQL报错ERROR 1615 (HY000): Prepared statement needs to be re-prepared

今天公司的项目视图查询报错。找了代码和视图的原因,发现表示没有问题的,视图就出错了。报错如下:

ERROR 1615 (HY000): Prepared statement needs to be re-prepared

很多情况是mysql的变量值设置不合理引起的,调整以下值:

table_open_cache 64=16384
table_definition_cache 256=16384
mysql set global table_open_cache=16384;

mysql set global table_definition_cache=16384;


如果一个平时能正常运行的存储过程,突然出现ERROR 1615 (HY000):Prepared statement needs to be re-prepared的错误

那么有可能是mysql的配置参数不合理引起的,解决方法如下

SHOW VARIABLES LIKE '%table_open_cache%';
Variable_name                         Value  
table_open_cache                   2000 
table_open_cache_instances   1   

SHOW VARIABLES LIKE '%table_definition_cache%';
Variable_name              Value  
table_definition_cache  4000  

调整变量值
-- table_open_cache
SET GLOBAL table_open_cache=16384;
SET GLOBAL table_definition_cache=16384;

作者:阿笨

      【官方QQ一群:跟着阿笨一起玩NET(已满)】:422315558跟着阿笨一起玩NET

      【官方QQ二群:跟着阿笨一起玩C#(已满)】:574187616跟着阿笨一起玩C#

      【官方QQ三群:跟着阿笨一起玩ASP.NET(已满)】:967920586跟着阿笨一起玩ASP.NET

      【官方QQ四群:Asp.Net Core跨平台技术开发(可加入)】:806491485Asp.Net Core跨平台技术开

      【官方QQ五群:.NET Core跨平台开发技术(可加入)】:1036896405.NET Core跨平台开发技术

      【网易云课堂】:https://study.163.com/provider/2544628/index.htm?share=2&shareId=2544628

      【腾讯课堂】:https://abennet.ke.qq.com

      【51CTO学院】:https://edu.51cto.com/sd/66c64

      【微信公众号】:http://dwz.cn/ABenNET

原文地址:https://www.cnblogs.com/51net/p/15164791.html