A brief Overview on MySQL
While connecting to MySQL server you may get many errors this means that your other available connections are being used by other clients.
With the help of max_connections system variable you can control number of permitted connections. But 100 is its default value. And if you want to increase number of connections, you can set high value for this system variable.
Requirements
To start this procedure you must have below mentioned decencies:
For root or a sudo user you must have SSH access
• Connecting via SSH to user server
• How do I enable root access?
• How do I disable SSH login for root user?
Instructions:
To increase the number of maximum connections of MySQL, edit the file /etc/my.cnf. And connect to server as root or sudo user via SSH, and type
Then you will see a section like this or may be somewhat different:
|
[mysqld] safe-show-database innodb_data_file_path=ibdata1:10M:autoextend datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock |
Under [mysqld] add following line:
Resulting configure file must 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 |
To restart mysqld save the changes and type:
|
/etc/init.d/mysqld restart |
Result will appear as-
|
Output: Stopping mysql: [ OK ] Starting mysql: [ OK ] |
If stopping FAILS, there will be some mistake, recheck all settings and make sure you have correctly entered new settings.
Important:
If you want to check settings whether it was applied successfully or not, use any of the below mentioned methods:
1. See mysql> prompt by Log into MySQL
|
mysql -uadmin -p`cat /etc/psa/.psa.shadow` |
2. Run Command
|
show variables like 'max_connections'; |
Remember to add semi column to the end.To exit Mysql, apply the quit command.