MySQL 5.5 – How to Disable UTF8MB4 Entirely

MySQLmysql-5.1mysql-5.5replicationutf-8

I know you're not supposed to do this, but I have a MySQL 5.5 master and a MySQL 5.1 replication slave. That's supposed to be okay, unless I do something stupid like use utf8mb4 that isn't supported by 5.1. Well, everything has been going well for a while and today I got a replication slave failure because character_set_client #45 isn't supported by MySQL 5.1.

I spent a lot of time trying to find out what #45 was… you see, it doesn't appear in any of MySQL's configuration files — even on 5.5. I finally determined it was utf8mb4 (which I had suspected) but I'm not sure why it's being used. I performed a static query on the master … something simple like UPDATE table SET field='value' and it replicated to the slave by setting the character set to utf8mb4. I executed hundreds of similar UPDATE statements at the same time, but some of them triggered the use of utf8mb4.

So… I'm going to be upgrading my slave to 5.5, but in the mean time is there a way to tell MySQL to never use utf8mb4?

Best Answer

POLITICALLY CORRECT ANSWER

You cannot do MySQL Replication from a New Master to an Old Slave

I have written many posts about this:

In addition, there is the likelihood of dealing with the internal BINLOG magic number being in the wrong place and replication going senile. Here are my posts on the BINLOG magic number:

Since there is nothing in the meantime you can do, please upgrade your Slave to MySQL 5.5

ALTERNATE PERSPECTIVE

In all fairness, @ChristopherSchultz is correct in that you can implement it. I just yell and scream "RISK !!!" to be more cautious because of the BINLOG magic number's place in the MySQL Replication Universe.