Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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

2 Answers 2

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
mysql> SHOW FULL PROCESSLIST\G

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

 
discard

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.