Skip to main content

Cannot set MYSQL 8 default encoding to Latin1 instead of UTF8

Comments

3 comments

  • cPRex Jurassic Moderator

    Hey there!  I know you mention that updating the scripts isn't an option, but you'll have to do that at some point - nothing is perfect forever.

    What do see right now when you run this command on the server?

    mysql -e "show variables like 'char%';"
    0
  • Michael Ernst

    The output of

    mysql -e "show variables like 'char%';"

    Is:

    character_set_client latin1
    character_set_connection latin1
    character_set_database latin1
    character_set_filesystem binary
    character_set_results latin1
    character_set_server latin1
    character_set_system utf8mb3
    character_sets_dir /usr/share/mysql-8.0/charsets/

    But if i do the same with a php script the output is a mix of utf8 and latin1 EXCEPT if i put one of the following lines in my /etc/my.cnf:

    skip-character-set-client-handshake = 1

    OR:

    init_connect = 'SET NAMES latin1'

    The good news is, even if i have

    skip-character-set-client-handshake = 1

    in there it seems not to break modern scripts like invision community, xenforo, mybb, phpbb, wordpress, joomla. (I tested it)

    So i will just keep the line and call it a day for now.

    0
  • cPRex Jurassic Moderator

    That sounds like a great solution!

    0

Please sign in to leave a comment.