-1
        /*
         * If using the `mysqlnd` library, the IPv6 address needs to be enclosed
         * in square brackets, whereas it doesn't while using the `libmysqlclient` library.
         * @see https://bugs.php.net/bug.php?id=67563
         */
        if ( $is_ipv6 && extension_loaded( 'mysqlnd' ) ) {
            $host = "[$host]";
        }

        if ( WP_DEBUG ) {
            mysqli_real_connect( $this->dbh, $host, $this->dbuser, $this->dbpassword, null, $port, $socket, $client_flags );
        } else {
            // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged
            @mysqli_real_connect( $this->dbh, $host, $this->dbuser, $this->dbpassword, null, $port, $socket, $client_flags );
        }

        if ( $this->dbh->connect_errno ) {
            $this->dbh = null;

            /*
             * It's possible ext/mysqli is misconfigured. Fall back to ext/mysql if:
             *  - We haven't previously connected, and
             *  - WP_USE_EXT_MYSQL isn't set to false, and
             *  - ext/mysql is loaded.
             */
            $attempt_fallback = true;

            if ( $this->has_connected ) {
                $attempt_fallback = false;
            } elseif ( defined( 'WP_USE_EXT_MYSQL' ) && ! WP_USE_EXT_MYSQL ) {
                $attempt_fallback = false;
            } elseif ( ! function_exists( 'mysql_connect' ) ) {
                $attempt_fallback = false;
            }

            if ( $attempt_fallback ) {
                $this->use_mysqli = false;
                return $this->db_connect( $allow_bail );
            }
        }
    } else {
        if ( WP_DEBUG ) {
            $this->dbh = mysql_connect( $this->dbhost, $this->dbuser, $this->dbpassword, $new_link, $client_flags );
        } else {
            // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged
            $this->dbh = @mysql_connect( $this->dbhost, $this->dbuser, $this->dbpassword, $new_link, $client_flags );
        }
    }**

help me find the bug please. I have done everything I could.

nbk
  • 20,484
  • 4
  • 19
  • 35
  • the user has no access to the database, chakeck with the mysql client if you can access the databse. – nbk May 26 '21 at 15:37

0 Answers0