• Support
  • mysqli::real_connect(): (HY000/2002): No such file or directory

can confirm i had the same issue using same installation, phpmyadmin 5.0, litespeed + php7.4 and mariadb 10.4 (centos 8) and the solution shared worked for me.

switch on phpmyadmin config.inc
$cfg['Servers'][$i]['host'] = 'localhost';
to
$cfg['Servers'][$i]['host'] = '127.0.0.1';

also using wordpress i had to switch on wpconfig.php from localhost to 127.0.0.1

my /etc/hosts file have configured
127.0.0.1 localhost

    2 months later

    Okay, I have had this happen a number of times now as well, and I do believe they have all been with OLS. I am using Debian 10 BTW, and it was working fine, went for e reboot for something else, and broke. Can we get a fix for this? Seems like something that shouldn't be too hard.

      gacott
      This problem should be caused by the created mysql sock soft link and then deleted after restarting, let me check again

      2 months later

      Ok, i think im having the same issue. i have centos 8. All was good and the one day i had to create a new website and using the installation script i get this error> Database connection failed: SQLSTATE[HY000] [2002] No such file or directory
      My other websites work fin without any sql problems.... any ideas how to fix or should i just uninstall php 7.4 and mysql ?

        2 months later

        Solution is to change the php config. Make sure you have the following lines:

        pdo_mysql.default_socket = /tmp/mysql.sock
        mysqli.default_socket = /tmp/mysql.sock

          10 months later

          Have the same problem mit Centos8, OLS und MariaDB.
          The Workaround with using 127.0.0.1 works, but when is it going to be fixed by default?

            aaP_gruchow

            neotheghost
            Hello, I think your problem is a problem with php's function of handling mysql, from a deeper level your website code is written with a lower version of php so that it is not compatible with the current version of php and MySQL

              I'm using php 7.4
              Both, Wordpress and phpmyadmin that have the problem, should be 100% compatible with php7.4
              Might MariaDB 10.5 be the problem?

              a year later

              x3inspire
              Hello, it is recommended to check whether mariadb is running.
              Check whether the /tmp/mysql.sock file exists

                x3inspire
                Hi, can you give us your aapanel information? The server makes a snapshot backup first, if possible, please send it to kern@aapanel.com.
                It is recommended to fill in the following
                Post link:
                SSH IP address, account password and port:
                aapanel login link address and account password:

                No post link will not be able to know which user's information is

                a year later

                admin, i need your help, i have problem with it.


                I checked and my mysql.sock file has .lock added at the end. When I open the file, there are only lines like the image I uploaded. Can anyone help me how to fix it?

                  15 days later

                  nuiteam11
                  Hello, is the problem solved? It is recommended that you describe the problem in detail

                  6 months later


                  hello admin, i just installed mysql but it cannot start, can you help me?

                    Connect with us: 📨 Telegram 💬 Discord Email: support@aapanel.com