Symptoms
-
An attempt to login into Plesk panel fails with the error:
DB query failed: SQLSTATE[08004] [1040] Too many connections
-
The MySQL service status shows this to be active but a code
exitedand afailurestatus:# service mysql status
● mysql.service - LSB: Start and stop the mysql database server daemon
Loaded: loaded (/etc/init.d/mysql)
Active: active (running) since Tue 2020-06-30 16:16:24 CEST; 15min ago
Process: 29285 ExecStop=/etc/init.d/mysql stop (code=exited, status=1/FAILURE)
Process: 31746 ExecStart=/etc/init.d/mysql start (code=exited, status=0/SUCCESS)
CGroup: /system.slice/mysql.service
├─2077 /bin/bash /usr/bin/mysqld_safe
├─3150 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib/mysql/plugin --user=mysql --skip-log-error --pid-file...
└─3151 logger -t mysqld -p daemon.error -
The service does not stop if this operation is attempted but changes to a
failedstatus:# systemctl stop mysql.service
● mysql.service - LSB: Start and stop the mysql database server daemon
Loaded: loaded (/etc/init.d/mysql)
Active: *failed (Result: exit-code) since Tue 2020-06-30 16:34:51 CEST; 12s ago
Process: 7254 ExecStop=/etc/init.d/mysql stop (code=exited, status=1/FAILURE)
Process: 31746 ExecStart=/etc/init.d/mysql start (code=exited, status=0/SUCCESS)
Cause
MySQL or its subprocesses are stuck and unresponsive.
Resolution
- Connect to the server via SSH
-
Retry to stop MySQL service manually:
# systemctl stop mysql.service
-
Check if any mysql process still is running with:
# pidof -c /usr/sbin/mysqld
And:
# ps awufx | grep mysql | grep -v grep
-
If any output was obtained on the previous step then Kill all these mysql processes manually by taking its IDs for example:
* From:
# pidof -c /usr/sbin/mysqld
7327# ps awufx | grep mysql | grep -v grep
root 7187 0.0 0.0 21820 3504 ? S 21:32 0:00 /bin/bash /usr/bin/mysqld_safe
mysql 7327 0.1 2.0 624472 81944 ? Sl 21:32 0:00 \_ /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib/mysql/plugin --user=mysql --skip-log-error --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/run/mysqld/mysqld.sock --port=3306
root 7328 0.0 0.0 23684 2476 ? S 21:32 0:00 \_ logger -t mysqld -p daemon.error* Run the kill command with all the above processes IDs as follows:
# kill -9 7187 7327 7328
-
Be sure that there the mysql process is no longer running, an empty output is expected, otherwise repeat step 4:
# pidof -c /usr/sbin/mysqld
-
Restart the MySQL service:
# systemctl start mysql.service
Comments
Please sign in to leave a comment.