See the attached image when PHP 5.6 cannot connect to MySQL 8.
Cannot log in to the MySQL server
mysqli_real_connect(): Server sent charset (255) unknown to the client. Please, report to the developers
mysqli_real_connect(): (HY000/2054): Server sent charset unknown to the client. Please, report to the developers
MySQL 8 uses by default the utf8mb4 character set, a character set not supported by the MySQL library of PHP 5.6.
You have to tell MySQL to use utf8 instead of utf8mb4.
In the my.ini file of the MySQL version 8 used, under the section name [wampmysqld] or [wampmysqld64] for the 64bit version add character-set-server=utf8