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

created at 08-23-2021 views: 56

Today the company’s project view query reported an error. I looked for the code and the reason for the view, and found that if there was no problem, the view was wrong. The error is as follows:

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

Many situations are caused by unreasonable setting of mysql variable values. Adjust the following values:

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

If a stored procedure that can run normally, ERROR 1615 (HY000): Prepared statement needs to be re-prepared suddenly appears

Then it may be caused by unreasonable mysql configuration parameters, the solution is as follows

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  

adjust the value of variables:

-- table_open_cache
SET GLOBAL table_open_cache=16384;
SET GLOBAL table_definition_cache=16384;
created at:08-23-2021
edited at: 08-23-2021: