MySQL error 1040 “Too many connections” & Increase max connections
That number of connections is defined via the max_connections
system variable. To open for more connections, you can set a higher value for max_connections
.
To see the current value of max_connections
, run this command:
SHOW VARIABLES LIKE "max_connections";
whatever the value you see, you can increase this value to the amount your RAM can handle connection.
formula to calculate no of max connection we can increase up to
max.connection=(available RAM-global buffers)/thread buffers
so you need to make changes in a file called my.cnf ,normally it’s stored in /etc/my.cnf
).
Under the [mysqld]
section add the following line:
max_connections = 500 //how much you want
max_user_connections = 5000 //how much you want
and restart the server (if you are using CLI enter command service httpd restart to restart the server)
How to Check all above info without going to the file directly
Write an info file on your server containing
<?php phpinfo();
View the file in your browser and check the max_execution_time
When you want to import large files(XXGB) through MySQL workbench and you get error or incompleate upload
Solution: first on the safe side make sure you have set PHP parameters properly so that you can upload large files and can use maximum execution time from that end. If not, go ahead and set below three parameters from php.ini file
- max_execution_time=3000000 (Set this as per your req)
- post_max_size=4096M
- upload_max_filesize=4096M
Once that's done get back to finding phpMyadmin config file named something like "config.default.php". On XAMPP you will find it under "C:\xampp\phpMyAdmin\libraries" folder. Open the file called config.default.php
and set :
$cfg['ExecTimeLimit'] = 0;
Once set, restart your MySQL and Apache and go import your database.
0 Comments