The error in Plesk: ERR [panel] SQLSTATE[HY000] [2002] No such file or directory, Can't connect to local MySQL server through socket

Follow

Comments

1 comment

  • Avatar
    Ehud Ziegelman

    Hi Taras Ermoshin,

     

    After manually setting the above, and testing they are in place:

    root@:/var/lib/psa/dumps# grep mysql.sock /etc/mysql/my.cnf
    socket=/var/lib/mysql/mysql.sock
    root@:/var/lib/psa/dumps# grep mysql.sock /etc/psa/psa.conf
    MYSQL_SOCKET /var/lib/mysql/mysql.sock
    root@:/var/lib/psa/dumps# grep mysql.sock /usr/local/psa/admin/conf/php.ini
    pdo_mysql.default_socket="/var/lib/mysql/mysql.sock"

    I have tried to run CLI:

    # zcat mysql.daily.dump.0.gz | sed -n '/-- Current Database: `psa`/,/-- Current Database:*/p' | plesk db
    ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

    Thus, I have searched for that OTHER path to the socket, and found the below:

    # grep -r "/var/run/mysqld/mysqld.sock" /var/*
    /var/lib/dpkg/info/plesk-fail2ban-configurator.postinst:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/plesk-dovecot.prerm:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/plesk-core.preinst:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/plesk-ui-library.postinst:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/plesk-dovecot.postinst:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/psa-vhost.postinst:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/psa-firewall.postinst:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/psa-firewall.postinst:       local mysql_socket="/var/run/mysqld/mysqld.sock"
    /var/lib/dpkg/info/psa-firewall.postinst:       local MYSQL_SOCKETS="/var/lib/mysql/mysql.sock /tmp/mysql.sock /var/run/mysqld/mysqld.sock"
    /var/lib/dpkg/info/libapache2-mod-fcgid-psa.prerm:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/libpam-plesk.prerm:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/plesk-fail2ban-configurator.prerm:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/plesk-awstats-configurator.postinst:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/plesk-service-node-utilities.postinst:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/plesk-dovecot-imap-driver.prerm:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/psa-proftpd.postinst:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/plesk-mail-pc-driver.prerm:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/plesk-mail-pc-driver.preinst:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/plesk-web-hosting.postinst:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/psa-mail-driver-common.preinst:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/plesk-dns-bind-driver.postrm:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/plesk-task-manager.prerm:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/psa-mail-driver-common.postinst:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/plesk-modsecurity-crs.postinst:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/psa-phpmyadmin.postinst:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/psa-phpmyadmin.postinst:     local mysql_socket="/var/run/mysqld/mysqld.sock"
    /var/lib/dpkg/info/psa-phpmyadmin.postinst:     local MYSQL_SOCKETS="/var/lib/mysql/mysql.sock /tmp/mysql.sock /var/run/mysqld/mysqld.sock"
    /var/lib/dpkg/info/plesk-dovecot-imap-driver.postrm:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/plesk-repair-kit.postinst:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/plesk-fail2ban-configurator.preinst:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/psa-proftpd.prerm:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/plesk-task-manager.postinst:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/psa.preinst:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/plesk-web-socket.prerm:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/psa-phpmyadmin.prerm:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/psa-phpmyadmin.prerm:        local mysql_socket="/var/run/mysqld/mysqld.sock"
    /var/lib/dpkg/info/psa-phpmyadmin.prerm:        local MYSQL_SOCKETS="/var/lib/mysql/mysql.sock /tmp/mysql.sock /var/run/mysqld/mysqld.sock"
    /var/lib/dpkg/info/plesk-service-node-utilities.prerm:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/sw-collectd.postinst:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/psa-firewall.prerm:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/psa-firewall.prerm:  local mysql_socket="/var/run/mysqld/mysqld.sock"
    /var/lib/dpkg/info/psa-firewall.prerm:  local MYSQL_SOCKETS="/var/lib/mysql/mysql.sock /tmp/mysql.sock /var/run/mysqld/mysqld.sock"
    /var/lib/dpkg/info/plesk-mail-pc-driver.postinst:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/plesk-resctrl.prerm:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/plesk-dovecot-imap-driver.preinst:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/psa-proftpd.postrm:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/psa-mail-driver-common.prerm:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/plesk-control-panel.postinst:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/libpam-plesk.postinst:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/plesk-modsecurity-configurator.postinst:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/psa-phpmyadmin.preinst:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/psa-phpmyadmin.preinst:      local mysql_socket="/var/run/mysqld/mysqld.sock"
    /var/lib/dpkg/info/psa-phpmyadmin.preinst:      local MYSQL_SOCKETS="/var/lib/mysql/mysql.sock /tmp/mysql.sock /var/run/mysqld/mysqld.sock"
    /var/lib/dpkg/info/plesk-dovecot-pigeonhole.postinst:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/plesk-dovecot.postrm:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/psa-php-configurator.postinst:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/plesk-web-socket.postinst:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/plesk-dovecot-imap-driver.postinst:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/plesk-core.postrm:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/psa-proftpd.preinst:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/plesk-config-troubleshooter.prerm:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/plesk-config-troubleshooter.prerm:   local mysql_socket="/var/run/mysqld/mysqld.sock"
    /var/lib/dpkg/info/plesk-config-troubleshooter.prerm:   local MYSQL_SOCKETS="/var/lib/mysql/mysql.sock /tmp/mysql.sock /var/run/mysqld/mysqld.sock"
    /var/lib/dpkg/info/plesk-l10n.prerm:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/plesk-core.postinst:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/plesk-core.postinst: local mysql_socket="/var/run/mysqld/mysqld.sock"
    /var/lib/dpkg/info/plesk-core.postinst: local MYSQL_SOCKETS="/var/lib/mysql/mysql.sock /tmp/mysql.sock /var/run/mysqld/mysqld.sock"
    /var/lib/dpkg/info/plesk-modsecurity-configurator.prerm:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/plesk-dovecot.preinst:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/plesk-config-troubleshooter.postinst:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/plesk-config-troubleshooter.postinst:        local mysql_socket="/var/run/mysqld/mysqld.sock"
    /var/lib/dpkg/info/plesk-config-troubleshooter.postinst:        local MYSQL_SOCKETS="/var/lib/mysql/mysql.sock /tmp/mysql.sock /var/run/mysqld/mysqld.sock"
    /var/lib/dpkg/info/plesk-l10n.postinst:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/psa.postinst:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/plesk-backup-utilities.postinst:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/plesk-dns-bind-driver.prerm:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/plesk-dns-bind-driver.postinst:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/plesk-core.prerm:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/plesk-core.prerm:    local mysql_socket="/var/run/mysqld/mysqld.sock"
    /var/lib/dpkg/info/plesk-core.prerm:    local MYSQL_SOCKETS="/var/lib/mysql/mysql.sock /tmp/mysql.sock /var/run/mysqld/mysqld.sock"
    /var/lib/dpkg/info/plesk-mail-pc-driver.postrm:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/libapache2-modsecurity-plesk.prerm:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/lib/dpkg/info/plesk-l10n.preinst:MYSQL_SOCKET=/var/run/mysqld/mysqld.sock
    /var/log/mysql/error.log:2023-04-23T08:11:32.713768Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.32-0ubuntu0.22.04.2'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  (Ubuntu).
    /var/log/mysql/error.log:2023-04-23T08:17:55.163246Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.32-0ubuntu0.22.04.2'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  (Ubuntu).
    grep: /var/run/snapd/ns/lxd.mnt: Invalid argument

     

    Can you please guide me?

    0
    Comment actions Permalink

Please sign in to leave a comment.

Have more questions? Submit a request