diff --git a/src/wp-includes/wp-db.php b/src/wp-includes/wp-db.php index 667ee3b25a..4bba086d3f 100644 --- a/src/wp-includes/wp-db.php +++ b/src/wp-includes/wp-db.php @@ -1327,6 +1327,10 @@ class wpdb { } else { @mysqli_real_connect( $this->dbh, $host, $this->dbuser, $this->dbpassword, null, $port, $socket, $client_flags ); } + + if ( $this->dbh->connect_errno ) { + $this->dbh = null; + } } else { if ( WP_DEBUG ) { $this->dbh = mysql_connect( $this->dbhost, $this->dbuser, $this->dbpassword, $new_link, $client_flags );