"Server sent charset unknown to the client" Error

Provides a tutorial example on how to resolve the 'Server sent charset unknown to the client' error received in PHP mysqli_connect() call to MySQL 8.0 running on CentOS 8 systems.

If you are running an older version of PHP on a client computer and tries to connection a MySQL 8.0 running on a CentOS system with the mysqli_connect() function, you will get the "Server sent charset unknown to the client" error:

herong$ php --version
PHP 5.6.30 (cli) (built: Oct 10 2017 20:30:32)

herong$ php test.php
PHP Warning:  mysqli_connect(): Server sent charset (255) unknown
   to the client. Please, report to the developers
   in /Users/herong/test.php on line 10.
PHP Warning:  mysqli_connect(): (HY000/2054): Server sent charset ...

Based on reports on the Internet, the above issue is caused by the default setting of "character_set_client = utf8mb4", which is unknown to older PHP "mysqli" modules.ß

I have tried a number of solutions suggested on the Internet. None of them works for me. Combinations of them are also not working.

The only solution that worked for my is to upgrade PHP to

herong$ php --version
PHP 7.2.11 (cli) (built: Oct  9 2018 15:09:36) ( NTS )

herong$ php test.php
mysqli_get_server_info() = 8.0.17
mysqli_get_host_info() = 192.168.1.100 via TCP/IP

Table of Contents

 About This Book

 Introduction to Linux Systems

 Cockpit - Web Portal for Administrator

 Process Management

 Files and Directories

 Users and Groups

 File Systems

 Installing CentOS

 SELinux - Security-Enhanced Linux

 Network Connection on CentOS

 Software Package Manager on CentOS - DNF and YUM

 Running Apache Web Server (httpd) on Linux Systems

 Running PHP Scripts on Linux Systems

Running MySQL Database Server on Linux Systems

 Install MySQL Database Server on CentOS

 Manage MySQL Server 'mysqld' on CentOS

 Set MySQL Server "root" Password on CentOS

 MySQL Server File Locations on CentOS

 MySQL Server Data Backups on CentOS

 MySQL Server Log Files on CentOS

 MySQL Server Socket Connection on CentOS

 MySQL Server TCP/IP Connection on CentOS

 Open Firewall for MySQL Server on CentOS

"Server sent charset unknown to the client" Error

 Performance of Inserting Integers to MySQL Database

 Performance Comparison of Inserting Integers vs. Strings

 Running Python Scripts on Linux Systems

 vsftpd - Very Secure FTP Daemon

 Postfix - Mail Transport Agent (MTA)

 Dovecot - IMAP and POP3 Server

 Email Client Tools - Mail User Agents (MUA)

 GCC - C/C++ Compiler

 Conda - Environment and Package Manager

 Tools and Utilities

 References

 Full Version in PDF/EPUB