I have a website that receives a lot of searches, so I need a cache.
The VPS is under the plesk license and the OS is Centos.
I have used the following command to implement a cache in mysql several days ago:
SET GLOBAL query_cache_size = 16777216;
The problem is that after some days the query_cache_size is reset automatically:
mysql> SHOW VARIABLES LIKE 'query_cache_size';
+------------------+-------+
| Variable_name | Value |
+------------------+-------+
| query_cache_size | 0 |
+------------------+-------+
1 row in set (0.00 sec)
This is the file /etc/my.cnf:
[mysqld]
bind-address = 127.0.0.1
local-infile = 0
datadir = /var/lib/mysql
socket = /var/lib/mysql/mysql.sock
user = mysql
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
query_cache_size = 16777216
query_cache_type = 1
query_cache_limit = 1048576
How can I fix this problem?