MySQL优化(六) - 开启查询缓存

版权声明:转载需附上本文地址 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语句会和平常一样,之后就会很快。

猜你喜欢

转载自blog.csdn.net/weikaixxxxxx/article/details/86589883