beachCode
beachCode

Reputation: 3530

Setting utf8mb4 permanently for GCP CloudSQL instance

To allow multi-byte characters (e.g., emojis) to be written to various columns, I'm using SET NAMES utf8mb4; to set the character set and various other server settings for a GCP CloudSQL instance.

The issue is that the setting is not permanent if I run it as a SQL command. How can I make it permanent (even on restart of the instance)? I have set one flag (character_set_server), but that wasn't enough. Do I need to add a bunch of flags?

Upvotes: 2

Views: 647

Answers (1)

Maxim
Maxim

Reputation: 4441

You can configure the DB's flags by editing the Cloud SQL instance and going to Add database flags > Add item.

In your case, add the item character_set_server and select utf8mb4 from the drop-down list. Remember that a restart is needed in order for the changes to take effect.

You can find a list of the supported flags here.

Upvotes: 1

Related Questions