• 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

ERROR: PleskDBException: Unable to connect to database

Kingsley

Silver Pleskian
Hello;

After i rebooted my server i got the following update when trying to access my dashboard, this always happens to me, one reason i dont like to use plesk on ubuntu. i am more comfortable with ubuntu.

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)
 
I suppose that you should check why MySQL service didn't start after reboot.
 
It is usual linux administrative task not related to Plesk. Mysql logs, startup script, etc. should be checked...
 
Hello IgorG , I've the same issue and after i've did with the solution https://kb.odin.com/en/126880
mv /etc/init/mysql.conf /etc/init/mysql.conf.off
It's display - mv: cannot stat ‘/etc/init/mysql.conf’: No such file or directory
It's still have the issue. Please help
 
I recently experienced this issue on a vanilla plesk 12.5 Centos 6.7 setup. Found that the issue was related to MYSQL 5.6 odbc driver.

It might be worth while to check your /etc/odbc.ini and make sure all connectors are in your /lib64/ as expected. I was missing a driver which was also causing a /var/run/mysqld/mysqld.sock (Error code: 2002).
 
@cookkoo - I firstly check the DSN in etc/odbcinst.ini:

Code:
[MySQL]
Description             = MySQL driver for Plesk
Driver          = /usr/lib64/libmyodbc5.so
Setup           =
FileUsage               = 1
Driver64                = /usr/lib64/libmyodbc5.so
Setup64         =
UsageCount              = 1

Then checked that libmyodbc5.so exists:
Code:
ls -la /usr/lib64/libmyodbc5.so

It wasn't found although: locate libmyodbc5.so tells me /etc/lib64/

I then changed the DSN to an existing odbc connector:

Code:
[CODE][MySQL]
Description             = MySQL driver for Plesk
Driver          = /usr/lib64/libmyodbc5a.so
Setup           =
FileUsage               = 1
Driver64                = /usr/lib64/libmyodbc5a.so
Setup64         =
UsageCount              = 1
[/CODE]

This then generated the above mentioned error in the dashboard, application vault & subscriber panel. "No such file or directory /var/run/mysqld/mysqld.sock "

to reconfigure the socket for the driver I then added a syslink:
Code:
ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
To keep the syslink live incase of reboot:
Code:
if [ ! -L /tmp/mysql.sock ]; then  ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock ; fi

mysqld on RedHat/CentOS by default stores socket at /var/lib/mysql/mysql.sock but it seems that your system is looking in /tmp/mysql.sock
 
shoxicwaste , It's still have the issue. Then i run as suggestion in http://kb.plesk.com/en/128936 with.

On Ubuntu/Debian:
# service mysql status
mysql.service - LSB: Start and stop the mysql database server daemon
Loaded: loaded (/etc/init.d/mysql)
Active: failed (Result: exit-code) since Tue 2016-05-17 14:51:35 ICT; 5h 22min ago

May 17 14:51:35 cookkoo.com mysql[1206]: /etc/init.d/mysql: ERROR: The partition with /v...ed!
May 17 14:51:35 cookkoo.com systemd[1]: mysql.service: control process exited, code=exit...s=1
May 17 14:51:35 cookkoo.com systemd[1]: Failed to start LSB: Start and stop the mysql da...on.
May 17 14:51:35 cookkoo.com systemd[1]: Unit mysql.service entered failed state.
Hint: Some lines were ellipsized, use -l to show in full.

# service mysqld start
Failed to start mysqld.service: Unit mysqld.service failed to load: No such file or directory.

Please suggestion.
 
shoxicwaste Thank again for your reply. And sorry, as i'm a Construction Engineer not a programmer. You ask me in deep of programming. I can only use PUTTY and follow from example code. Please help to order for. What i should to put in PUTTY ? and i will follow you. Thank you again :)
 
shoxicwaste , I test to put in by systemctl enable mysql.service :) and the result is
# systemctl enable mysql.service
Synchronizing state for mysql.service with sysvinit using update-rc.d...
Executing /usr/sbin/update-rc.d mysql defaults
Executing /usr/sbin/update-rc.d mysql enable
 
From your code above the result as below:

mysql.service - LSB: Start and stop the mysql database server daemon
Loaded: loaded (/etc/init.d/mysql)
Active: failed (Result: exit-code) since Tue 2016-05-17 14:51:35 ICT; 6h ago

May 17 14:51:35 cookkoo.com mysql[1206]: /etc/init.d/mysql: ERROR: The partition with /var/lib/mysql is too full! ... failed!
May 17 14:51:35 cookkoo.com systemd[1]: mysql.service: control process exited, c ode=exited status=1
May 17 14:51:35 cookkoo.com systemd[1]: Failed to start LSB: Start and stop the mysql database server daemon.
May 17 14:51:35 cookkoo.com systemd[1]: Unit mysql.service entered failed state.
May 17 21:17:48 cookkoo.com systemd[1]: Stopped LSB: Start and stop the mysql da tabase server daemon.
 
The result as below:

# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/md2 2.0T 1.9T 0 100% /
udev 10M 0 10M 0% /dev
tmpfs 6.3G 82M 6.2G 2% /run
tmpfs 16G 0 16G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 16G 0 16G 0% /sys/fs/cgroup
/dev/md1 488M 36M 427M 8% /boot
/dev/md3 8.9T 41M 8.5T 1% /home
tmpfs 3.2G 0 3.2G 0% /run/user/0
 
/dev/md2 - this is a raid setup?

Are you sure this isn't a space issue?

this command can help determine the biggest files on your system:
du -a / | sort -n -r | head -n 15
 
Back
Top