• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • We are looking for U.S.-based freelancer or agency working with SEO or WordPress for a quick 30-min interviews to gather feedback on XOVI, a successful German SEO tool we’re looking to launch in the U.S.
    If you qualify and participate, you’ll receive a $30 Amazon gift card as a thank-you. Please apply here. Thanks for helping shape a better SEO product for agencies!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

Issue I need help - DB query failed: SQLSTATE [HY000] [2002]

ElvisB

New Pleskian
Hello dear community,
I hope that someone can help me, I read a lot in the forum and probably did not understand what I have to do. When I call Plesk the following error occurs:

Server Error
500 Plesk\Exception\Database
DB query failed: SQLSTATE[HY000] [2002] No such file or directory
TypePlesk\Exception\Database
MessageDB query failed: SQLSTATE[HY000] [2002] No such file or directory
FileMysql.php
Line60

I can connect to the server via SSH, but then it becomes difficult for me ... Maybe someone can help me directly, of course I would also send the required data and show myself recognizable.

I am thankful for every help.

Many Greetings
Elvis Binder
 
Hi,

Normally such error happens when MySQL is stoped.
You can first try to start it:
Code:
# service mysql start
or
Code:
# service mariadb start

if that does not work fail then provide the following outputs:
Code:
# df -h
# df -i
# service mysql status
or
# service mariadb status
 
Thanks for your message, that's the answer from the server

Code:
[root@h2633269 ~]# service mariadb start
Redirecting to /bin/systemctl start mariadb.service
Job for mariadb.service failed because the control process exited with error code. See "systemctl status mariadb.service" and "journalctl -xe" for details.

Code:
[root@h2633269 ~]# df -h
Dateisystem    Größe Benutzt Verf. Verw% Eingehängt auf
/dev/vzfs       800G     88G  713G   11% /
devtmpfs        8,0G       0  8,0G    0% /dev
tmpfs           8,0G    4,0K  8,0G    1% /dev/shm
tmpfs           8,0G    103M  7,9G    2% /run
tmpfs           8,0G       0  8,0G    0% /sys/fs/cgroup
tmpfs           1,7G       0  1,7G    0% /run/user/0

Code:
[root@h2633269 ~]# df -i
Dateisystem      Inodes IBenutzt    IFrei IUse% Eingehängt auf
/dev/vzfs      15000000   979826 14020174    7% /
devtmpfs        2097152       58  2097094    1% /dev
tmpfs           2097152        2  2097150    1% /dev/shm
tmpfs           2097152      249  2096903    1% /run
tmpfs           2097152       10  2097142    1% /sys/fs/cgroup
tmpfs           2097152        1  2097151    1% /run/user/0

Code:
[root@h2633269 ~]# service mariadb status
Redirecting to /bin/systemctl status mariadb.service
● mariadb.service - MariaDB database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Mo 2020-05-18 18:31:37 CEST; 819ms ago
  Process: 29470 ExecStartPost=/usr/libexec/mariadb-wait-ready $MAINPID (code=exited, status=1/FAILURE)
  Process: 29469 ExecStart=/usr/bin/mysqld_safe --basedir=/usr (code=exited, status=0/SUCCESS)
  Process: 29433 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n (code=exited, status=0/SUCCESS)
 Main PID: 29469 (code=exited, status=0/SUCCESS)

Mai 18 18:31:36 h2633269.stratoserver.net mariadb-prepare-db-dir[29433]: Data...
Mai 18 18:31:36 h2633269.stratoserver.net mysqld_safe[29469]: 200518 18:31:36...
Mai 18 18:31:36 h2633269.stratoserver.net mysqld_safe[29469]: 200518 18:31:36...
Hint: Some lines were ellipsized, use -l to show in full.
 
I have the exact same problem (except my is line 64). The mysqld service is stopped and fails to start. I tried restarting the server but that didn't help. This post might be the same problem as mine and this one here discusses an update issue with Mariadb.

Code:
lvmetad is stopped
dmeventd is stopped
mailman is stopped
mdmonitor (pid  2451) is running...
messagebus (pid  2463) is running...
mysqld is stopped
netconsole module not loaded
Configured devices:
lo eth0
Currently active devices:
lo eth0
nginx (pid  7400) is running...
ntpd (pid  2535) is running...
psa-pc-remote (pid  2725) is running...
reset_instance_data is stopped
reconfigurator is stopped
php-fpm is stopped
php-fpm is stopped
php-fpm is stopped
php-fpm is stopped
php-fpm is stopped
php-fpm is stopped
php-fpm is stopped
plesk-web-socket is stopped
portreserve is stopped
master (pid 2711) is running...
postmaster is stopped
                                                                      is running
usage: /etc/init.d/psa-firewall (start|stop|restart|help)
rdisc is stopped
rsyslogd (pid  1487) is running...
sandbox is stopped
saslauthd is stopped
smartd is stopped
spamd (pid  2548) is running...
openssh-daemon (pid  2513) is running...
sw-collectd is stopped
sw-cp-serverd (pid  3076) is running...
sw-engine-fpm (pid  3044) is running...
xinetd (pid  2524) is running...

Code:
# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/md1              4.0G  1.4G  2.7G  34% /
/dev/mapper/vg00-usr  103G  3.5G   94G   4% /usr
/dev/mapper/vg00-var  103G  2.2G   95G   3% /var
/dev/mapper/vg00-home
                      3.9G  8.0M  3.7G   1% /home
none                  3.9G  1.5M  3.9G   1% /tmp

# df -i
Filesystem            Inodes  IUsed   IFree IUse% Mounted on
/dev/md1              262144  31801  230343   13% /
/dev/mapper/vg00-usr 6815744 161440 6654304    3% /usr
/dev/mapper/vg00-var 6815744  22756 6792988    1% /var
/dev/mapper/vg00-home
                      262144     11  262133    1% /home
none                 1005822    376 1005446    1% /tmp

From the mysqld.log file:
Code:
190701  1:46:10 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.1.73'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  Source distribution
210108 19:52:43 [ERROR] /usr/libexec/mysqld: Incorrect key file for table '/tmp/#sql_b4b_0.MYI'; try to repair it
210108 19:54:54 [ERROR] /usr/libexec/mysqld: Incorrect key file for table '/tmp/#sql_b4b_0.MYI'; try to repair it

And when I stop and restart the PSA I get the following - Can't connect through mysql.sock:
Code:
Trying to start service mysqld... mysqld is stopped
Starting mysqld:                                           [FAILED]

Warning: start service mysqld failed

done
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
httpd (pid  2742) is running...

It seems like maybe something happened to one of the tables in a database. I'm not sure why this would prevent the mysqld service from starting. There are the three files ibdata1, ib_logfile0 and iblogfile1. The last time these were modified is about the same time that my website and mysqld went down. There are two files in my primary database "oc_customer_online.MYI" and "oc_customer_online.MYD" that were also modified a few minutes after the other three. So it would seem the last thing the database did was update those tables. I repaired them using myisamchk but mysqld still will not start.

I tried this. Didn't work. Not sure if I need to reverse this or not.
Code:
ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
service mysqld restart


My next thought is to remove the server and reinstall it using the following:
Code:
yum remove mysql-server

yum clean all

yum install mysql
 
Last edited:
Back
Top