• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion
  • Inviting everyone to the UX test of a new security feature in the WP Toolkit
    For WordPress site owners, threats posed by hackers are ever-present. Because of this, we are developing a new security feature for the WP Toolkit. If the topic of WordPress website security is relevant to you, we would be grateful if you could share your experience and help us test the usability of this feature. We invite you to join us for a 1-hour online session via Google Meet. Select a convenient meeting time with our friendly UX staff here.

Resolved ERROR: PleskDBException: Unable to connect to database: mysql_connect():

daanse

Regular Pleskian
Hi,

i'm using: "12.5.30 Update #23, zuletzt aktualisiert: 25. Febr. 2016 23:00:41" and today it seems that Plesk updated automatically (turned it off just in case now) and everything was down:

ERROR: PleskDBException: Unable to connect to database: mysql_connect(): Resource temporarily unavailable /var/run/mysqld/mysqld.sock (Error code: 2002). Please check that database server is started and accessible. (Abstract.php:69)

after that, i made a restart.

ERROR: PleskDBException: Unable to connect to database: mysql_connect(): No such file or directory /var/run/mysqld/mysqld.sock (Error code: 2002). Please check that database server is started and accessible. (Abstract.php:69)

in meanwhile ...

Error displaying the error page: Application Instantiation Error: Could not connect to MySQL.

Current Status after restart...

What can i do against this? It's really annoying. This happened 10 Times the last Year always at round about 7 o' clock (Germany)... My Customers will kill me the next time this happends..

The Solution for the moment was to hit "/etc/init.d/apache2 restart" in SSH..

Any Leads or How To's or Answers would be great.
 
How can i check? Which command do i need to run?
I'm using Debian 8.3
But on two other Servers i got this Problem last Year over 10 Times. There i had Cent OS and always Latest Version.
 
HI,
Thank you.

"/var/log/mysqld.log" is empty. No Errors.

Maybe its related to the recently activated Firewall Settings? Could this cause such a Problem?
 
Have you tried to restart mysql service at least?
 
Yes. Its okay now but i'm afraid about the next Update. I turned off "automatic Update" but i got to a Point where i want to figure out the Causes...
I had this really often with different Servers in the Past.
I think i am missing something.

What i know, one Server without Firewall active (don't know why it was deactivated) there where no Problems.
 
I still have these Errors for 1-5 Minutes in the morning and then its fine again.
What can i do?
 
again this morning. :-( Really need help here.
whis is something i could get out

Code:
systemctl status 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 Sun 2016-03-06 07:22:15 CET; 11s ago
  Process: 26652 ExecStop=/etc/init.d/mysql stop (code=exited, status=1/FAILURE)
  Process: 26695 ExecStart=/etc/init.d/mysql start (code=exited, status=1/FAILURE)

Mar 06 07:21:44 my-domain.com /etc/init.d/mysql[26722]: 160306 0...
Mar 06 07:22:15 my-domain.com mysql[26695]: Starting MariaDB dat...
Mar 06 07:22:15 my-domain.com systemd[1]: mysql.service: control...
Mar 06 07:22:15 my-domain.com systemd[1]: Failed to start LSB: S...
Mar 06 07:22:15 my-domain.com systemd[1]: Unit mysql.service ent...
Hint: Some lines were ellipsized, use -l to show in full.
root@web-host04 ~ # systemctl status mysql.service -l
● mysql.service - LSB: Start and stop the mysql database server daemon
   Loaded: loaded (/etc/init.d/mysql)
   Active: failed (Result: exit-code) since Sun 2016-03-06 07:22:15 CET; 19s ago
  Process: 26652 ExecStop=/etc/init.d/mysql stop (code=exited, status=1/FAILURE)
  Process: 26695 ExecStart=/etc/init.d/mysql start (code=exited, status=1/FAILURE)

Mar 06 07:21:44 my-domain.com /etc/init.d/mysql[26722]: 160306 07:21:44 mysqld_safe A mysqld process already exists
Mar 06 07:22:15 my-domain.com mysql[26695]: Starting MariaDB database server: mysqld . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . failed!
Mar 06 07:22:15 my-domain.com systemd[1]: mysql.service: control process exited, code=exited status=1
Mar 06 07:22:15 my-domain.com systemd[1]: Failed to start LSB: Start and stop the mysql database server daemon.
Mar 06 07:22:15 my-domain.com systemd[1]: Unit mysql.service entered failed state.
root@web-host04 ~ # service apache2 restart
root@web-host04 ~ # etc/init.d/mysqld restart
-bash: etc/init.d/mysqld: No such file or directory
root@web-host04 ~ # service mysql restart
Job for mysql.service failed. See 'systemctl status mysql.service' and 'journalctl -xn' for details.
root@web-host04 ~ # service pache restart
Failed to restart pache.service: Unit pache.service failed to load: No such file or directory.
root@web-host04 ~ #

and i found under "Trouble Shooter - Protocol Search" following:
Code:
18: /opt/psa/admin/plib/CommonPanel/Application/Abstract.php:131
    CommonPanel_Application_Abstract->_initTranslate()
19: /opt/psa/admin/plib/CommonPanel/Application/Abstract.php:39
    CommonPanel_Application_Abstract->run()
20: /opt/psa/admin/plib/CommonPanel/Application/Abstract.php:18
    CommonPanel_Application_Abstract::init()
21: /opt/psa/admin/plib/pm/Bootstrap.php:15
    pm_Bootstrap::init()
22: /opt/psa/admin/plib/sdk.php:12
[2016-03-06 06:30:03] ERR [1] SQLSTATE[HY000]: General error: 23 Out of resources when opening file '/tmp/#sql_459_1.MAI' (Errcode: 24 "Too many open files")
[2016-03-06 07:05:01] ERR [panel] Unable to connect to database:  /var/run/mysqld/mysqld.sock (Error code: 2002). Please check that database server is started and accessible.:
0: /opt/psa/admin/plib/CommonPanel/Application/Abstract.php:69
    CommonPanel_Application_Abstract::initDbAdapter()
1: /opt/psa/admin/plib/Session/Helper.php:150
    Plesk\Session\Helper::initStorage()
2: /opt/psa/admin/plib/CommonPanel/Application/Abstract.php:36
    CommonPanel_Application_Abstract->run()
3: /opt/psa/admin/plib/CommonPanel/Application/Abstract.php:18
    CommonPanel_Application_Abstract::init()
4: /opt/psa/admin/plib/pm/Bootstrap.php:15
    pm_Bootstrap::init()
5: /opt/psa/admin/plib/sdk.php:12
[2016-03-06 07:05:01] ERR [1] Unable to connect to database:  /var/run/mysqld/mysqld.sock (Error code: 2002). Please check that database server is started and accessible.
[2016-03-06 07:10:01] ERR [panel] Unable to connect to database:  /var/run/mysqld/mysqld.sock (Error code: 2002). Please check that database server is started and accessible.:
0: /opt/psa/admin/plib/CommonPanel/Application/Abstract.php:69
    CommonPanel_Application_Abstract::initDbAdapter()
1: /opt/psa/admin/plib/Session/Helper.php:150
    Plesk\Session\Helper::initStorage()
2: /opt/psa/admin/plib/CommonPanel/Application/Abstract.php:36
    CommonPanel_Application_Abstract->run()
3: /opt/psa/admin/plib/CommonPanel/Application/Abstract.php:18
    CommonPanel_Application_Abstract::init()
4: /opt/psa/admin/plib/pm/Bootstrap.php:15
    pm_Bootstrap::init()
5: /opt/psa/admin/plib/sdk.php:12
[2016-03-06 07:10:01] ERR [panel] Unable to connect to database:  /var/run/mysqld/mysqld.sock (Error code: 2002). Please check that database server is started and accessible.:
0: /opt/psa/admin/plib/CommonPanel/Application/Abstract.php:69
    CommonPanel_Application_Abstract::initDbAdapter()
1: /opt/psa/admin/plib/Session/Helper.php:150
    Plesk\Session\Helper::initStorage()
2: /opt/psa/admin/plib/CommonPanel/Application/Abstract.php:36
    CommonPanel_Application_Abstract->run()
3: /opt/psa/admin/plib/CommonPanel/Application/Abstract.php:18
    CommonPanel_Application_Abstract::init()
4: /opt/psa/admin/plib/pm/Bootstrap.php:15
    pm_Bootstrap::init()
5: /opt/psa/admin/plib/sdk.php:12
[2016-03-06 07:10:01] ERR [1] Unable to connect to database:  /var/run/mysqld/mysqld.sock (Error code: 2002). Please check that database server is started and accessible.
[2016-03-06 07:10:01] ERR [1] Unable to connect to database:  /var/run/mysqld/mysqld.sock (Error code: 2002). Please check that database server is started and accessible.
[2016-03-06 07:10:34] ERR [panel] Unable to connect to database:  /var/run/mysqld/mysqld.sock (Error code: 2002). Please check that database server is started and accessible.:
...... and 100 Lines more

i think the First line is my Problem: [2016-03-06 06:30:03] ERR [1] SQLSTATE[HY000]: General error: 23 Out of resources when opening file '/tmp/#sql_459_1.MAI' (Errcode: 24 "Too many open files") ????
After this the Server was down i think?

Does this helps?
Code:
root@web-host04 ~ # ulimit -Hn
65536
root@web-host04 ~ # ulimit -Sn
65536
root@web-host04 ~ # ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 257438
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 65536
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 257438
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited
root@web-host04 ~ #
 
Last edited:
Hi, view the Log.
if its say somewhere "too many files open" its about changing MySQL Setting "open Files Limit"
This and gracefully restart worked always for me.
Actually i never had Problems again (after increasing Value)
 
Yes I think it's the same probleme, but I doesn't have the open_limit_file on /etc/mysql/my.conf. And I don't know where is it !
I'm on Debian 8.0‬ - Plesk 12.5.30.

On my.conf :
Code:
!includedir /etc/mysql/conf.d/
[mysqld]
#bind-address = ::
bind-address = **.*.*.*
skip_name_resolve
local-infile=0

On my /etc/security/limits.conf :
Code:
#*               soft    core            0
#root            hard    core            100000
#*               hard    rss             10000
#@student        hard    nproc           20
#@faculty        soft    nproc           20
#@faculty        hard    nproc           50
#ftp             hard    nproc           0
#ftp             -       chroot          /ftp
#@student        -       maxlogins       4
When i did "mysql -uadmin -p`cat /etc/psa/.psa.shadow` psa -e "SHOW VARIABLES LIKE 'Open_files_limit';" : I show : 1024 and I know I must Increase this values, but i don't know where !
 
Back
Top