Warning: wp-includes/wp-db.php on line 1515

When WordPress 4.5 upgrade,  giving this error:

Warning: mysql_connect(): Headers and client library minor version mismatch. Headers:50546 Library:50627 in /home/xxxxxxxx/public_html/wp-includes/wp-db.php on line 1515

This error appears on the website or/and unable to get wp-admin page.

On the login page (wp-admin) this error occurs:

Warning: Cannot modify header information – headers already sent by (output started at /home/xxxxxxxxx/public_html/wp-includes/wp-db.php:1515) in /home/xxxxxxxxxx/public_html/wp-includes/pluggable.php on line 1171

Solution wp-db.php on line 1515 :

In wp-includes, finds this file „wp-db.php” and edit.
Change this line:

 $this->dbh = mysql_connect( $this->dbhost, $this->dbuser, $this->dbpassword, $new_link, $client_flags );

with to…

if ( WP_DEBUG ) {
 $this->dbh = mysql_connect( $this->dbhost, $this->dbuser, $this->dbpassword, $new_link, $client_flags );
 } else {
 $this->dbh = @mysql_connect( $this->dbhost, $this->dbuser, $this->dbpassword, $new_link, $client_flags );
 }

Do not forget – SAVE.