Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Set the maximum allowed number of connections in MySQL

Answer:

MySQL has a setting which prevent the database from overloaded due to too many concurrent connections. This value should depends on the processing power of your database server, e.g. CPU, memory, disks I/O.

To change the value, edit the MySQL configurations, e.g. /etc/my.cnf

..
max_connections=100
..

So if a client connecting to the database exceeded this value, they will be blocked.

Don't forget to restart MySQL to take effect.

# /sbin/service mysqld restart

  1. Block a client from connecting to MySQL if too many errors
  2. Change the maximum allowed binary log file size in MySQL
  3. Disable MySQL server from listening for TCP/IP connections
  4. Enable external locking in MySQL
  5. Enable MySQL binary log (bin log)

Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>