关键词搜索

源码搜索 ×
×

SQLSTATE[HY000]:General error: 1615 Prepared statement needs to be re-prepared

发布2018-03-07浏览7369次

详情内容

 

解决办法:

\config\database.php加上

'options' => [
\PDO::ATTR_EMULATE_PREPARES => true
]

https://blog.csdn.net/haibo0668/article/details/81258861

 

  MYSQL默认的table_open_cache为64,这个数值是偏小的,如果max_connections较大,则容易引起性能问题。

    表现:数据库查询效率慢,show processlist 发现比较多的查询正在opening table。
    进一步确认,执行以下语句:
mysql> show global status like 'open%tables%';
+---------------+---------+
| Variable_name | Value   |
+---------------+---------+
| Open_tables   | 345     |
| Opened_tables | 9734116 |
+---------------+---------+
    Opened_tables数值非常大,说明cache太小,导致要频繁地open table,可以查看下当前的table_open_cache设置:
mysql> show variables like '%table_open_cache%';
+------------------+-------+
| Variable_name    | Value |
+------------------+-------+
| table_open_cache |     64|

+------------------+-------+

修改  table_open_cache值

mysql> set global table_open_cache=1024;

可以粗略这样子设置:服务器内存2G    table_open_cache设置2048


比较适合的值:

Open_tables / Opened_tables >= 0.85
Open_tables / table_cache <= 0.95

 

 

清空缓存

执行

1mysql > flush tables;

命令将会清空当前所有缓存的表。

 

 

 

原值

相关技术文章

点击QQ咨询
开通会员
返回顶部
×
微信扫码支付
微信扫码支付
确定支付下载
请使用微信描二维码支付
×

提示信息

×

选择支付方式

  • 微信支付
  • 支付宝付款
确定支付下载