Kiran
Kiran

Reputation: 916

MySQL database - conversion of characterset and collation to utf8mb4 and utf8mb4_unicode_ci?

I have converted charset and collation of my mysql database from latin1 to utf8mb4 using the collowing commands as advised here

ALTER DATABASE databasename CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE tablename CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

To check the conversion was done properly, I have run the following command.

  SHOW VARIABLES WHERE Variable_name LIKE 'character\_set\_%' 
  OR Variable_name LIKE 'collation%' 

The output is

enter image description here

While character_set_client, character_set_connection, character_set_database, character_set_results are now in utf8mb4, character_set_filesystem is in binary and character_set_server is still in latin. What exactly these and why it is still not in utf8mb4?

Similarly, collation_connection and collation_database are in utf8mb4_unicode_ci, but collation_server is still in latin1_swedish_ci

Upvotes: 1

Views: 2392

Answers (1)

Bill Karwin
Bill Karwin

Reputation: 562230

https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_character_set_filesystem

This variable is used to interpret string literals that refer to file names, such as in the LOAD DATA INFILE and SELECT ... INTO OUTFILE statements and the LOAD_FILE() function. Such file names are converted from character_set_client to character_set_filesystem before the file opening attempt occurs. The default value is binary, which means that no conversion occurs.

You probably don't need to change this value.

https://dev.mysql.com/doc/refman/5.7/en/charset-server.html

The server character set and collation are used as default values if the database character set and collation are not specified in CREATE DATABASE statements. They have no other purpose.

You can change this value in your /etc/my.cnf but it's redundant since if you already specify the character set for each database.

Upvotes: 1

Related Questions