The maximum number of connections MySQL / cache settings

First, the maximum number of connections:

  1 , view the current maximum number of database connections: SHOW the VARIABLES the LIKE '%% max_connections';

  2, set the maximum number of connections to the database:

    1) provided in the current session, after failure of restart of the database:

      SET GLOBAL max_connections = 1000;

    2 ) in the database configuration file my.ini located in, long-term effective:

      max_connections=151

       

Second, the cache:

  1 , open: in my.ini in [mysqld] was added the following:

    query_cache_size = 32M

    query_cache_type = 1

    // set after the restart the service;

  2 , the query cache is turned on:

    SHOW VARIABLES LIKE '%query_cache%';

  3 , the use of attention:

    1) open the cache is repeated a second time inquiry, will speed up;

    2) If the modified cache data corresponding to the new, causes the cache cleared;

    3) Because the operation will clear the cache additions and deletions, additions and deletions resulting in slower operation;

    4) it is mainly used for frequent queries, additions and deletions small database;

 

Guess you like

Origin www.cnblogs.com/Tractors/p/11286068.html