Support / KnowledgeBase

 
Search the KnowledgeBase Search

(dv) Increasing Max MySQL Connections

  • Applies to: All (dv)

  • Difficulty: Easy

  • Time needed: 10 minutes

  • Tools needed: SSH

 
  • Applies to: All (dv)
    • Difficulty: Easy
    • Time Needed: 10
    • Tools Required: SSH

Details

To increase the maximum connections that MySQL allows, you must edit the file /etc/my.cnf. Log into the server as root, and type this:


vi /etc/my.cnf

There will be a section that looks like this: (may be slightly different)


[mysqld]
safe-show-database
innodb_data_file_path=ibdata1:10M:autoextend
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

Add the following line under [mysqld]


max_connections=250

The resulting config file should resemble this:


[mysqld]
safe-show-database
innodb_data_file_path=ibdata1:10M:autoextend
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
max_connections=250

You then save the changes, and type the following to restart mysqld:


/etc/init.d/mysqld restart

You will see:


Stopping mysql: [ OK ]
Starting mysql: [ OK ]

If stopping FAILS, then you did something wrong. Try to backtrack and make sure you entered the new setting correctly.

NOTE:

If you'd like to check to see if this setting was successfully applied, you may check using one of the following methods:

  1. Log into MySQL and you will be at the "mysql>" prompt.
    
    mysql -uadmin -p`cat /etc/psa/.psa.shadow`
    
  2. Then give the command
    
    show variables like 'max_connections';
    
    Make sure you put the semi-colon on the end. To exit mysql, use the "quit" command.

Resources

The authoritative source for this information may be found at the following URL:
http://dev.MySQL.com/doc/refman/4.1/en/too-many-connections.html.


User Comments

No visitor comments posted. Post a comment
Fields marked with an asterisk(*) are required. Comment on this article
Fill out the form below if you would like to comment on this article.
 
 
 

(code is not case-sensitive)
 
Submit
 
 

Continue