版权声明:转载需附上本文地址 https://blog.csdn.net/weikaixxxxxx/article/details/86589883
查看是否开启
mysql> show variables like '%query_cache%';
表示没开启。
开启只需到/etc/my.cnf
中添加以下内容,如果里面已经有[mysqld]
就不需要加
[mysqld]
query_cache_size = 128M
query_cache_type = ON
如果这个目录下没有,那就# find / -name mysql.cnf
修改完重启mysql。
开启后查询第一条sql语句会和平常一样,之后就会很快。