Logo Background RSS

Enable caching in MySQL

  • Log into your mysql

    $ mysql -u root –p

    Output:

    Enter password:

    Welcome to the MySQL monitor. Commands end with ; or \g.

    Your MySQL connection id is 16 to server version: 4.1.15-Debian_1-log
    Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.

    mysql>

    Now setup cache size 32Mb:
    mysql> SET GLOBAL query_cache_size = 33554432;    
    
    Query OK, 0 rows affected (0.00 sec)
    mysql> SHOW VARIABLES LIKE 'query_cache_size';

    Output:

    +——————+———-+

    | Variable_name | Value |

    +——————+———-+

    | query_cache_size | 16777216 |

    +——————+———-+

    You can setup them in /etc/my.cnf (Red Hat) or /etc/mysql/my.cnf (Debian) file:
    # vi /etc/my.cnf
    Append config directives as follows:

    query_cache_size = 33554432
    query_cache_type=1
    query_cache_limit=2096576
    
                    
  1. #1 vanderbilt beach
    September 28th, 2011 at 12:00 pm

    One definitely has to keep a very close eye on the server load to drastically reduce loads. Thanks for the detailed steps. Usually, the moderator information stays the same. Table-level caching available in MySQL does not offer performance improvements in the event of changes in the users table. Alternatively, a cache can be put up with PHP to cache all the moderator information.

    Post ReplyPost Reply
Leave a Comment