• Skip to primary navigation
  • Skip to main content
  • Skip to footer
  • Home
  • About
  • My Blogs
    • Photoblog
    • Knots
    • WP.com tips
kristarella.com

kristarella.com

Happiness Engineer at Automattic, lover of knitting, crochet, sci-fi and more

  • Presentations
  • Plugins
    • Exifography
  • Contact
You are here: Home / My life & thoughts / Fixed my WordPress MySQL charsets

Fixed my WordPress MySQL charsets

7 January 2017 by kristarella Leave a Comment

Nerd alert: I’m posting this in case anyone finds themselves with the same issue and needs a fix; if you don’t care about databases feel free to skip this one 🤓

For a recent post I wanted to use an emoji. I also wanted to use emojis in a post ages ago and wasn’t able to… but WordPress supports emoji! So, what was up with that?

As it turns out, my database encoding and charsets were all over the shop. This is understandable; when I first created this site I knew little about databases and the default charset for most MySQL databases (at least those created in phpMyAdmin) was latin and the collation was set to latin1_swedish_ci.

I remember changing these to utf8 a long time ago, but that was before utf8mb4 (a better implementation of utf8 in MySQL; the previous one was limited). I also only changed my database and tables, not each individual column.

In order to get proper emoji support happening I wanted to update everything to utf8mb4. I’m not a whiz with SQL queries, so I ended up just going through each table and changing the encoding and collation. Sequel Pro makes this pretty easy and only slightly tedious.

As I was doing that I noticed that some columns (those with data types of varchar, enum, and also the post_content and post_title columns) kept their encoding despite the change to the table. I guess that’s so the data doesn’t get messed up, which is good, but annoying for my purposes.

An article from Atlassian , MySQL Collation Repair, was great for fixing most of the columns, but for post_content and post_title I kept getting the following error.

Column ‘post_content’ cannot be part of FULLTEXT index

I’m not sure where I found the following code, but basically you have to change any column that are in the FULLTEXT index at the same time, otherwise they won’t budge. The following queries worked for me.

ALTER TABLE `wp_posts`
MODIFY COLUMN `post_content` longtext CHARACTER SET binary,
MODIFY COLUMN `post_title` text CHARACTER SET binary;
ALTER TABLE `wp_posts`
DEFAULT CHARSET=utf8mb4,
MODIFY COLUMN `post_content` longtext CHARACTER SET utf8mb4,
MODIFY COLUMN `post_title` text CHARACTER SET utf8mb4;

Side note: props to this post for making me smile. While the solutions proposed didn’t quite fit my situation the alternate title of The things we do to store U+1F4A9 PILE OF POO (💩) correctly was bang on!

Share this:

  • Click to share on Facebook (Opens in new window) Facebook
  • Click to share on X (Opens in new window) X
  • Click to share on Pocket (Opens in new window) Pocket

Like this:

Like Loading...

Related

Filed Under: My life & thoughts, WordPress Tagged With: mysql

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

A triptych of baubles. These are very satisfying t A triptych of baubles. These are very satisfying to paint ❤️💚💙

#watercolor #watercolour #christmas
I have really enjoyed this Christmassy painting! S I have really enjoyed this Christmassy painting! So glad my friend asked me to make some cards for our church helpers, because it set me on a roll!
#watercolor #watercolour #christmas #christmascards #watercolorcards
Had a great Saturday at the GKR Karate State Title Had a great Saturday at the GKR Karate State Titles! I was a sub for @jamesxuereb.me in the Blue Flame Dragons thanks to his sprained ankle; we won first round and came fourth overall!
I did a bunch of judging and officiating, which was really good.
I didn’t place in my individual events, but had a very fun final round of kumite (sparring).

#gkrkarate #karate
More stamping tonight. Even better than last night More stamping tonight. Even better than last night’s!
Did some stamping this evening. Love it! I wish I’d done some pages in other ink colours before I dismantled the stamps 😂
Had an appointment in the city, so I got to visit Had an appointment in the city, so I got to visit the @legocertifiedstores_anz Wicked display!
#wicked #lego #afol #sydney
A little book I made from Bunnings paint sample ca A little book I made from Bunnings paint sample cards. It’s going to be for mini paintings and collages. Sometimes it’s nice to start with a colour rather than a blank white page!
A little while ago I did some swatching of Daniel A little while ago I did some swatching of Daniel Smith and Schminke Horodam watercolours. So soothing! I love some of the granulating colours!
#watercolours
Follow on Instagram

Footer

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Top Posts & Pages

  • Home
    Home
  • 2020: the year that wasn't
    2020: the year that wasn't
  • The Voice Referendum
    The Voice Referendum
  • Exifography
    Exifography
  • Clickable tags for WordPress
    Clickable tags for WordPress
  • Edit EPS files in Inkscape on Mac
    Edit EPS files in Inkscape on Mac

Follow Me On…

  • Instagram
  • X
  • GitHub
  • LinkedIn
  • YouTube

Categories

Copyright © 2025 · Kristen Symonds · kristarella.com

%d