too many mysql connections

On the mysql command line:

The following two commans are useful to determine current connections:

  •   SHOW STATUS WHERE `variable_name` = 'Threads_connected';
  •   SHOW PROCESSLIST;

Centos prompt

You may update the mysql configuration which is located under /etc/my.cnf.

Two variables you may like to review are:

Unix replace string in file

A string can be replaced within a unix file using the 'sed' command. For example, it may that you've created a MySQL dump and you want to update a string and then import it back into the database.

For example, let's say we have a string '/var/www/vhosts/intranet2' within a file named 'intranet.sql' and we want to replace it with '/var/www/vhosts/intranet' and save it into a new file named 'intranet-updated.sql'.

You simply need to enter:

Database bottlenecks

Here are some basic strategies for optimising Drupal's use of the database.

Enabling MySQL's Query Cache

To enable add the following lines to to your MySQL options file - the file is named my.cnf and specifies the variables and behaviour from your MySQL server.

# The MySQL Server
[mysqld]
query_cache_size=64M

The current cache size can be viewed as output of MySQL's SHOW VARIABLES command:

SHOW VARIABLES LIKE 'query_cache%';

query_cache_size | 67108864
query_cache_type | ON