Home > MySql > How to enable mysql query cache

How to enable mysql query cache

August 6th, 2012 Leave a comment Go to comments

How to enable mysql query cache

Please note that i am enabling the mysql query caching limit to 20MB. I have converted the 20MB to 20971520KB

Login to the server via SSH.

Type “mysql” command

It will show the below output.

[email protected] [~]# mysql Welcome to the MySQL monitor.  Commands end with ; or \g. Your MySQL connection id is 99955 Server version: 5.1.62-cll MySQL Community Server (GPL)

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

Then fire the below command in mysql

mysql> SHOW VARIABLES LIKE ‘query_cache_size’;

Then fire the below command to set the mysql query cache.

mysql> SET GLOBAL query_cache_size =20971520;

Then check the cache value again.

mysql> SHOW VARIABLES LIKE ‘query_cache_size’;

Then exit the mysql be pressing Ctrl+D

Open my.cnf file and insert the below line vi /etc/my.cnf

query_cache_size = 268435456
query_cache_type=1
query_cache_limit=1048576

save the file and restart mysql

 

Categories: MySql Tags:
  1. No comments yet.
  1. No trackbacks yet.
You must be logged in to post a comment.