2

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?

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

10 Comments

thx. I just checked to be sure. that's the flag I already set (and restarted) but it wasn't enough.
@beachCode Sorry, I misread the part where you said you already have set character_set_server. Are you using MySQL 5.6 or 5.7?
@beachCode If the MySQL version is 5.7, try also setting character_set_system, character_set_client, and collaction_connection to the same value.
No problem, you didn’t miss it. I hadn’t mentioned it by name—that was an edit. It’s 5.7. I’ll try setting those in the morning. Thanks again
@beachCode Alright, let me know the outcome once you've had time to make changes.
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.