Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've just run into a problem today with MySQL reaching its database connection capacity.

The error I'm receiving is, Error establishing a database connection. When I try to access /phpma, I get this error instead: phpMyAdmin - Error #1040 - Too many connections.

I've looked up how to change my.cnf to increase the number of connections, but I think I've already done this a while back and had no issues since. I'm therefore a little worried that these connections are some kind of vulnerability.

I'm running CentOS, but I'm a linux noob. Is there any easy way of checking these connections? Is there anything I should be looking out for, or maybe just a way of culling connections that have been active too long (does MySQL even work this way?).

Thanks in advance,

share|improve this question

To see the which threads are running in mysql, from Linux:

root@myserver:~> mysqladmin processlist

The equivalent mysql query to that would be:

root@myserver:~> mysql

Also, check out Examining Thread Information to see what the output means. Most notably:

Command and State indicate what the thread is doing.

Most states correspond to very quick operations. If a thread stays in a given state for many seconds, there might be a problem that needs to be investigated.

The main point is to look at the mysql process list and see if anything looks suspicious to you, given the nature of your environment, e.g. long-running processes or large # of processes.

share|improve this answer

Use this command and list out running mysql apps,

ps -aux | grep 'mysql'

then, start your required mysql in its default port "3306"

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.