R-Ts NetWorks

Server the Best

How to enable mysql query cache


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.

root@server [~]# 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

 

Advertisements

August 6, 2012 - Posted by | MySql

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: