Connecting to MySQL Cluster from PHP 5.6


For #reasons I have a PHP5.6 codebase I wish to deploy on a DO Droplet, connecting to a MySQL Cluster.

Obviously - PHP5.6 is bad and wrong and really we should upgrade to 7.3 or higher. However - we are caught on the hop and need a tactical solution to buy the time to finish the PHP8 compatibility work.

When attempting to connect with the following sample code:

	$conn = mysqli_init();

	if(!$conn) {
		die('init failed');

	mysqli_options($conn, MYSQLI_SET_CHARSET_NAME, 'utf8');

	$res = mysqli_real_connect($conn, 'dbclusteraddress:port',
	'username', 'password', 'dbname');

We get the connect_error 2054 with the description Server sent charset unknown to the client. Please, report to the developers

Beleive this is because the server will be sending back utf8mb4 which is the MySQL Default and not understood by PHP 5.6 MySQLi.

Is there a way we can change the PHP5.6 code/configuration to support/handle the utf8mb4 or a way to change the start up configuration of the server, i.e. this:


I can’t see that we have any access to the server (for obvious reasons) or any way we can set that value through the control panel.


Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.


In other to connect to the database, for clients/Users that support the “mysql_native_password” authentication such as some PHP apps

You will need to run the below " alter command " The below command can be used to change the authentication for the user after creation as well

ALTER USER myuser IDENTIFIED WITH mysql_native_password BY ‘mypassword’;

Below is a link that provides for more information on

You can change the authentication method by navigating to database cluster in cloud console and click on Users & Databases tab. After which you can click on More button and select Edit encryption method.

Please note:- Changing the password encryption method will change the password of user.

Hope this helps!

Cheers, Sri Charan