Question

Any way to disable charset-handshake and change default server charset in Managed MySQL?

Posted August 21, 2019 1.1k views
MySQL PHP DigitalOcean PHP Frameworks Databases

Too many old products can’t connect to new MySQL8.
All recommendations or rewrite old product, or change MySQL server settings like this:

[client]
default-character-set=utf8

[mysql]
default-character-set=utf8

[mysqld]
skip-character-set-client-handshake
character-set-client-handshake = 0
collation-server = utf8_unicode_ci
character-set-server = utf8
default_authentication_plugin = mysql_native_password

But how to do it in Managed MySQL?
Also “SET GLOBAL” way currently not available.

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.

3 answers

Hello!

To preserve the stability of the database cluster, users are not able to modify global variables. However, you can make this change on a database by database basis, as described here:

https://dev.mysql.com/doc/refman/8.0/en/charset-database.html

Here’s an example:
ALTER DATABASE database_name CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

Note however that this will just change the default charset for the database, all existing tables will have to be converted. You can do that with a command such as this one:

ALTER TABLE table_name CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

Hope it helps!

Is there any resolution for this. I have followed your instructions above and it fails either way.

The mysql managed DB is useless to me if we can’t connect to it with PHP.

I have only FPM version, trurlmcbyte/php-fpm:hack (PHP 5.6.40)

Submit an Answer