When I run SHOW VARIABLES WHERE Variable_name LIKE 'character\_set\_%' OR Variable_name LIKE 'collation%'
in MySQL, I get the following variables:
Variable_name Value
character_set_client utf8
character_set_connection utf8mb4
character_set_database utf8mb4
character_set_filesystem binary
character_set_results utf8
character_set_server utf8mb4
character_set_system utf8
collation_connection utf8mb4_unicode_ci
collation_database utf8mb4_unicode_ci
collation_server utf8mb4_general_ci
However, when I run a simple test to connect to MySQL in PHP without setting any encoding, mysql_client_encoding()
returns latin1
, yet that encoding is nowhere to be found in the MySQL character sets.
Why is this happening and how can I fix it so that I don't have to continually specify mysql_set_charset('UTF8');
every time I connect to MySQL?