【问题标题】:Can't enable MySQL 5.6 Query Cache无法启用 MySQL 5.6 查询缓存
【发布时间】:2015-10-19 18:23:01
【问题描述】:

我正在尝试使用 MySQL 5.6.25

Ubuntu 15.04 上启用 MySQL 查询缓存

我已将此添加到 /etc/mysql/my.cnf/etc/mysql/conf.d/mysql.cnf 的末尾:

query_cache_type = 1
query_cache_size = 4096M
query_cache_limit = 2M
query_cache_strip_comments =1

整个服务器已多次重启。

user@myhost:/$ mysql
mysql: unknown variable 'query_cache_type=1'

使用SHOW VARIABLES LIKE '%query_cache%' 确认query_cache_type = OFF

SET GLOBAL query_cache_type = 1;
/* SQL Error (1651): Query cache is disabled; restart the server with query_cache_type=1 to enable it */

我该如何解决这个问题?

【问题讨论】:

  • 你能做一个find -name "my.cnf",看看你的服务器上是否还有其他my.cnf?
  • 有:./etc/mysql/my.cnf ./etc/alternatives/my.cnf ./var/lib/dpkg/alternatives/my.cnf ./usr/my.cnf
  • usr/my.cnf 中有什么内容?
  • 您将参数放在my.cnf 中的什么位置?在 [mysqld] 下?
  • 我建议在这里发帖dba.stackexchange.com

标签: mysql caching


【解决方案1】:

编辑文件/etc/mysql/conf.d/mysql.cnf

添加

[mysqld]
query_cache_size = 268435456
query_cache_type=1
query_cache_limit=1048576

【讨论】:

  • mysql: [ERROR] unknown variable 'query_cache_type=1' 重启mysqld时出现这个错误
猜你喜欢
  • 2013-07-03
  • 2010-09-07
  • 1970-01-01
  • 1970-01-01
  • 2019-07-18
  • 2014-06-25
  • 2015-02-05
  • 2012-08-20
  • 1970-01-01
相关资源
最近更新 更多