Title: The utf8mb4 Upgrade
Author: Gary Pendergast
Published: April 2, 2015
Last modified: July 10, 2015

---

 [  ](https://profiles.wordpress.org/pento/) [Gary Pendergast](https://profiles.wordpress.org/pento/)
2:25 am _on_ April 2, 2015     
Tags: [4.2 ( 67 )](https://make.wordpress.org/core/tag/4-2/),
[dev-notes ( 654 )](https://make.wordpress.org/core/tag/dev-notes/), utf8mb4, [wpdb ( 6 )](https://make.wordpress.org/core/tag/wpdb/)

# The utf8mb4 Upgrade

In WordPress 4.2, we’re upgrading tables to utf8mb4, when we can. Your site will
only upgrade when the following conditions are met:

 * You’re currently using the utf8 character set.
 * Your MySQLMySQL MySQL is a relational database management system. A database 
   is a structured collection of data where content, configuration and other options
   are stored. [https://www.mysql.com](https://www.mysql.com/) server is version
   5.5.3 or higher (including all 10.x versions of MariaDB).
 * Your MySQL client libraries are version 5.5.3 or higher. If you’re using mysqlnd,
   5.0.9 or higher.

The difference between utf8 and utf8mb4 is that the former can only store 3 byte
characters, while the latter can store 4 byte characters. In Unicode terms, utf8
can only store characters in the [Basic Multilingual Plane](https://en.wikipedia.org/wiki/Plane_(Unicode)),
while utf8mb4 can store any Unicode character. This greatly expands the language
usability of WordPress, especially in countries that use [Han character sets](https://en.wikipedia.org/wiki/Han_unification).
[Unicode isn’t without its problems](https://modelviewculture.com/pieces/i-can-text-you-a-pile-of-poo-but-i-cant-write-my-name),
but it’s the best option available.

utf8mb4 is 100% backwards compatible with utf8.

Due to index size restrictions in MySQL, this does mean we need to re-create a handful
of indexes to fit within MySQL’s rules. Using a standard configuration, MySQL allows
767 bytes per index, which for utf8 means 767 bytes / 3 bytes = 255 characters. 
For utf8mb4, that means 767 bytes / 4 bytes = 191 characters. The indexes that will
be resized are:

`
 wp_usermeta.meta_key wp_terms.slug wp_terms.name wp_commentmeta.meta_key wp.postmeta.
meta_key wp_posts.post_name

And from Multisitemultisite Used to describe a WordPress installation with a network
of multiple blogs, grouped by sites. This installation type has shared users tables,
and creates separate database tables for each blog (wp_posts becomes wp_0_posts).
See also **network**, **blog**, **site**:

`
 wp_site.domain wp_sitemeta.meta_key wp_signups.domain

Of course, the Multisite (and wp_usermeta) keys obey the DO_NOT_UPGRADE_GLOBAL_TABLES
setting. The upgrade will only be attempted once, though we’ll probably add a check
in a future WordPress version to see if we can upgrade now (say, if you’ve upgraded
your MySQL server since upgrading to WordPress 4.2).

If you’re a pluginPlugin A plugin is a piece of software containing a group of functions
that can be added to a WordPress website. They can extend functionality or add new
features to your WordPress websites. WordPress plugins are written in the PHP programming
language and integrate seamlessly with WordPress. These can be free in the WordPress.
org Plugin Directory [https://wordpress.org/plugins/](https://wordpress.org/plugins/)
or can be cost-based plugin from a third-party. developer and your plugin includes
custom tables, please test that your indexes fit within MySQL’s limits. MySQL won’t
always produce an error when the index is too big, so you’ll need to manually check
the size of each index, instead of relying on automated testing.

EDIT: One more thing…

If you’d like to upgrade your custom tables to utf8mb4 (and your indexes are all
in order), you can do it really easily with the shiny new maybe_convert_table_to_utf8mb4(
$tablename ) function. It’s available in `wp-adminadmin (and super admin)/includes/
upgrade.php`, and will sanity check that your tables are entirely utf8 before upgrading.

[#4-2](https://make.wordpress.org/core/tag/4-2/), [#dev-notes](https://make.wordpress.org/core/tag/dev-notes/),
[#utf8mb4](https://make.wordpress.org/core/tag/utf8mb4/), [#wpdb](https://make.wordpress.org/core/tag/wpdb/)

### Share this:

 * [  Threads ](https://make.wordpress.org/core/2015/04/02/the-utf8mb4-upgrade/?share=threads)
 * [  Mastodon ](https://make.wordpress.org/core/2015/04/02/the-utf8mb4-upgrade/?share=mastodon)
 * [  Bluesky ](https://make.wordpress.org/core/2015/04/02/the-utf8mb4-upgrade/?share=bluesky)
 * [  X ](https://make.wordpress.org/core/2015/04/02/the-utf8mb4-upgrade/?share=x)
 * [  Facebook ](https://make.wordpress.org/core/2015/04/02/the-utf8mb4-upgrade/?share=facebook)
 * [  LinkedIn ](https://make.wordpress.org/core/2015/04/02/the-utf8mb4-upgrade/?share=linkedin)

 1.   ![](https://secure.gravatar.com/avatar/97dc2c73c59ee71f0d93c1fe54c8390d10696ecf7d0213db0a42f6cdc68c0d32?
      s=32&d=mm&r=g)
 2.    [Thomas Townsend](https://profiles.wordpress.org/smb-dev/)  2:33 am _on_ April
      2, 2015
 3.   Hi Gary, glad to see you and the team are looking after the devs too ? I owe 
      you a beer or tow if you even get down to Tampa Florid area…
 4.   ![](https://secure.gravatar.com/avatar/c64b8f97639b146b3a504e7d2cb44a6d7296f3a607e767abe41fa2cbc50cadbc?
      s=32&d=mm&r=g)
 5.    [Pippin Williamson](https://profiles.wordpress.org/mordauk/)  2:36 am _on_ April
      2, 2015
 6.   Excellent, thanks for the notice!
 7.   ![](https://secure.gravatar.com/avatar/b2cb7bb6c1b623ba5bf7b713259f22693db03b29b9f3308b0ac32c4121055679?
      s=32&d=mm&r=g)
 8.    [Todd Lahman](https://profiles.wordpress.org/toddlahman/)  3:47 am _on_ April
      2, 2015
 9.   Great to see WP Keeps moving forward. Thanks for the update Gary.
 10.  ![](https://secure.gravatar.com/avatar/7d4e6978df89809d15df65aac619677de2180d4e0ec5a613aece7c9e7103324d?
      s=32&d=mm&r=g)
 11.   [J.D. Grimes](https://profiles.wordpress.org/jdgrimes/)  1:03 pm _on_ April 
      2, 2015
 12.  [@pento](https://profiles.wordpress.org/pento/) I’ve noticed that the difference
      in index length can cause notices when updating tables using `dpDelta()`.
 13.  I was getting this error locally, when running the install tests for a pluginPlugin
      A plugin is a piece of software containing a group of functions that can be added
      to a WordPress website. They can extend functionality or add new features to 
      your WordPress websites. WordPress plugins are written in the PHP programming
      language and integrate seamlessly with WordPress. These can be free in the WordPress.
      org Plugin Directory [https://wordpress.org/plugins/](https://wordpress.org/plugins/)
      or can be cost-based plugin from a third-party. against WordPress trunktrunk 
      A directory in Subversion containing the latest development code in preparation
      for the next major release cycle. If you are running "trunk", then you are on
      the latest revision.:
 14.  `
       WordPress database error: [Duplicate key name ‘meta_key’] ALTER TABLE wptests_dbdelta_test3
      ADD KEY meta_key (meta_key) `
 15.  After some debugging, I found that dbDelta() was being thrown off by KEYs for
      VARCHAR columns, because the description of the key from the database would be
      like this:
 16.  `KEY meta_key (meta_key(191))`
 17.  But in my CREATE TABLE string, they are defined like this:
 18.  `KEY meta_key (meta_key)`
 19.  Since these don’t match `dbDelta()` attempts to add the key again, resulting 
      in the error. This would happen to users on sites that support utf8mb4, if the
      plugin is deactivated and then reactivated.
 20.  Kind of related: [#31388](https://core.trac.wordpress.org/ticket/31388).
 21.   * ![](https://secure.gravatar.com/avatar/e522019adbe7cb4145f9e01c344c036baaa8bf76cd5d76e6b737b60be9af88cc?
         s=32&d=mm&r=g)
       *  [Gary Pendergast](https://profiles.wordpress.org/pento/)  1:29 pm _on_ April
         2, 2015
       * Thanks for the bugbug A bug is an error or unexpected result. Performance 
         improvements, code optimization, and are considered enhancements, not defects.
         After feature freeze, only bugs are dealt with, with regressions (adverse 
         changes from the previous version) being the highest priority. report, [@jdgrimes](https://profiles.wordpress.org/jdgrimes/)!
         I’ve recorded it in [#31869](https://core.trac.wordpress.org/ticket/31869),
         I’ll have a think about the best way to fix it.
       * In the mean time, a valid work around is to specify the index length in your
         CREATE TABLE statement – this is what we’ve done in coreCore Core is the set
         of software required to run WordPress. The Core Development Team builds WordPress.,
         hence why I haven’t run into this bug previously.
 22.  ![](https://secure.gravatar.com/avatar/9e35c0706df5952c8f355001b31ec617dbd6e37552e0d0c712c1e8f7a40130c3?
      s=32&d=mm&r=g)
 23.   [pix365](https://profiles.wordpress.org/pix365/)  3:05 pm _on_ April 13, 2015
 24.  For folks on v4.1.1 ior earlier – Will there be a pluginPlugin A plugin is a 
      piece of software containing a group of functions that can be added to a WordPress
      website. They can extend functionality or add new features to your WordPress 
      websites. WordPress plugins are written in the PHP programming language and integrate
      seamlessly with WordPress. These can be free in the WordPress.org Plugin Directory
      [https://wordpress.org/plugins/](https://wordpress.org/plugins/) or can be cost-
      based plugin from a third-party. released that will perform the the sanity checks
      to ensure existing sites have all the SQL pre-requisites in place before folks
      even attempt the upgrade to 4.2. ( or have miss understood the above “Edit on
      the upgrade.php” or is this check is already built in to 4.1.1)
 25.   * ![](https://secure.gravatar.com/avatar/27180c82524020e7339e2b30818b6d8ab004c54f730f12b1434b1e365be0e175?
         s=32&d=mm&r=g)
       *  [Ipstenu (Mika Epstein)](https://profiles.wordpress.org/ipstenu/)  4:00 pm
         _on_ April 13, 2015
       * The checks are built in.
       * > Your site will only upgrade when the following conditions are met:…
       * That’s what’s doing it 🙂 If any condition fails, no DB changes. If you’re
         not even on the right version of MySQLMySQL MySQL is a relational database
         management system. A database is a structured collection of data where content,
         configuration and other options are stored. [https://www.mysql.com](https://www.mysql.com/),
         it won’t do it either.
 26.  ![](https://secure.gravatar.com/avatar/b0c8446f2b606e8f61eb9122ed8b3296c09e45d647045d26a2b343d59c965838?
      s=32&d=mm&r=g)
 27.   [snowboardmommy](https://profiles.wordpress.org/snowboardmommy/)  12:30 am _on_
      April 24, 2015
 28.  FWIW, I upgraded a multisitemultisite Used to describe a WordPress installation
      with a network of multiple blogs, grouped by sites. This installation type has
      shared users tables, and creates separate database tables for each blog (wp_posts
      becomes wp_0_posts). See also **network**, **blog**, **site** installation (with
      debug mode ON) to 4.2 today and also found a similar DB error message in the 
      error_log in wp-adminadmin (and super admin):
 29.  WordPress database error Duplicate key name ‘meta_key’ for query ALTER TABLE 
      wp_usermeta ADD KEY meta_key (meta_key(191)) made by wp_upgrade, make_db_current_silent,
      dbDelta
       WordPress database error Duplicate key name ‘domain’ for query ALTER
      TABLE wp_site ADD KEY domain (domain(140),path(51)) made by wp_upgrade, make_db_current_silent,
      dbDelta WordPress database error Duplicate key name ‘meta_key’ for query ALTER
      TABLE wp_sitemeta ADD KEY meta_key (meta_key(191)) made by wp_upgrade, make_db_current_silent,
      dbDelta WordPress database error Duplicate key name ‘domain_path’ for query ALTER
      TABLE wp_signups ADD KEY domain_path (domain(140),path(51)) made by wp_upgrade,
      make_db_current_silent, dbDelta
 30.  I haven’t peeked at the database (phpMyAdmin) yet, but everything appears to 
      be working alright.
 31.  ![](https://secure.gravatar.com/avatar/740b2572bb73a1674b20a2b820cf2ad620f997028169a3940e5ceb5f4ec546f3?
      s=32&d=mm&r=g)
 32.   [jalev](https://profiles.wordpress.org/jalev/)  8:01 am _on_ April 24, 2015
 33.  Hi Gary, I did the upgrade to 4.2 and afterwards it asks me for a database upgrade
      as I obviously belong to one of the cases you described above. The problem is
      that the Database Update process timeouts.
 34.  I have increased the timeout to 60 minutes but there is an alter query that after
      almost 15 minutes of running, it crashes my server as it takes all the ram and
      swap available. The query is the following: ALTER TABLE nB8KH50Wbb_options CONVERT
      TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci
 35.  and below it there is a huge que of locked queries as they try to write in the
      same table “Waiting for table metadata lock”.
 36.  Any ideas?
 37.   * ![](https://secure.gravatar.com/avatar/27180c82524020e7339e2b30818b6d8ab004c54f730f12b1434b1e365be0e175?
         s=32&d=mm&r=g)
       *  [Ipstenu (Mika Epstein)](https://profiles.wordpress.org/ipstenu/)  12:06 
         pm _on_ April 24, 2015
       * How big is your db? How big are your post and post metaMeta Meta is a term
         that refers to the inside workings of a group. For us, this is the team that
         works on internal WordPress sites like WordCamp Central and Make WordPress.
         tables?
          - ![](https://secure.gravatar.com/avatar/f847340cac151352b0bc321c16df9a032472b24bd496730d22dbecdaa1dbeec8?
            s=32&d=mm&r=g)
          -  [FolioVision](https://profiles.wordpress.org/foliovision/)  8:31 am _on_
            May 7, 2015
          - Hello Mika,
          - we had the same issue, we had to do this with a command line PHPPHP The
            web scripting language in which WordPress is primarily architected. WordPress
            requires PHP 7.4 or higher, see our link in other comment here.
          - Here is some info about the two sites where we had the issue:
          - Site 1: wp_posts 256MB, wp_postmeta 57MB, wp_comments 292MB, wp_commentmeta
            181.9MB, wp_options 19.8MB
             Site 2: wp_posts 84.9MB, wp_postmeta 5MB, wp_comments
            134MB, wp_commentmeta 173.7MB, wp_options 9MB
          - Perhaps you should improve the upgrade process to remember which queries
            finished before it times out. When it times out, it seems to be executing
            all the queries again, even if they finished before.
          - Thanks,
             Martin
             * ![](https://secure.gravatar.com/avatar/cf453681440f3a5ee09aed57fe4b715a6240e9cff0e8b194029dbc08d6f23c88?
               s=32&d=mm&r=g)
             *  [jstensved](https://profiles.wordpress.org/jstensved/)  4:26 pm _on_
               May 22, 2015
             * I can confirm that I’m having the exact same issue on another large 
               site which I can’t update. I’m updating from command line with WP-CLIWP-
               CLI WP-CLI is the Command Line Interface for WordPress, used to do administrative
               and development tasks in a programmatic way. The project page is [http://wp-cli.org/](http://wp-cli.org/)
               [https://make.wordpress.org/cli/](https://make.wordpress.org/cli/) but
               still the command will eventually consume all memory.
 38.  ![](https://secure.gravatar.com/avatar/c1dd3f9d8eae11dd3daf7f63d41e9da13c98db32a88126539ccff9e30e2b0a49?
      s=32&d=mm&r=g)
 39.   [l3hworks](https://profiles.wordpress.org/l3hworks/)  4:00 pm _on_ April 24,
      2015
 40.  Hello, I updated to 4.2 in xampp and now I can’t go back to my life server (mysqlMySQL
      MySQL is a relational database management system. A database is a structured 
      collection of data where content, configuration and other options are stored.
      [https://www.mysql.com](https://www.mysql.com/) 5.1), is there any way I could
      revert this?
 41.  ![](https://secure.gravatar.com/avatar/5c0f9aef5f9a419344320f10f29e577db1f79b3334b2e9874e72edc47631c40b?
      s=32&d=mm&r=g)
 42.   [Nihad](https://profiles.wordpress.org/9had/)  4:46 pm _on_ April 24, 2015
 43.  I’ve upgraded to 4.2 today, on two different domains, one is MultiSitemultisite
      Used to describe a WordPress installation with a network of multiple blogs, grouped
      by sites. This installation type has shared users tables, and creates separate
      database tables for each blog (wp_posts becomes wp_0_posts). See also **network**,**
      blog**, **site** (Danish) other one (in English) is not.
       I’ve got no errors,
      so all is good. But my encoding is wrong. Content is not being displayed properly,
      even if it is created and saved as UTF8. On both sites.
 44.  Since then, in troubleshooting, I’ve manually converted my db/data/tables from
      UTF8 to UTF8MB4, to see if this will resolve the issue. Nope.
       Iconv utility 
      converting data to UTF8 just in case it was not. Did nothing either. My data 
      looking at it directly in mysqlMySQL MySQL is a relational database management
      system. A database is a structured collection of data where content, configuration
      and other options are stored. [https://www.mysql.com](https://www.mysql.com/)
      looks good. Even Sequel Pro displays data correctly.
 45.  It worked perfectly on pre 4.2… now it does not.
       Posts that are incorrectly 
      displayed are non editable in WordPress either. It show, empty titles and contents.
      and when you save them, they are empty. So it’s like it can’t recognize encoding
      and then it just saves it as empty.
 46.  But… If i copy data directly from database, paste is into a post, that is displayed
      as empty, in WordPress editor, and save it… It works correctly. So already existing
      data is somehow read incorrectly, but if the same data is copied into the editor
      and save to database it is good.
 47.  Seems like there is an issue, in updating of database that went wrong somewhere.
 48.   * ![](https://secure.gravatar.com/avatar/2c450e67646dcefc36b82c838ae3233a7f23777aec7f608b1282a253611c6f71?
         s=32&d=mm&r=g)
       *  [sistemasBebetter](https://profiles.wordpress.org/sistemasbebetter/)  6:51
         pm _on_ April 29, 2015
       * Have you found any solution to this? I’m having the same problem but only 
         with one of the sites I have (the others in the same computer and database
         upgrade correctly).
          Which WP version had your sites before upgrading?
       * ![](https://secure.gravatar.com/avatar/ba954c2901deb15bd9ff34b48a1b1594b3312769944c9db85f663439a8f701c7?
         s=32&d=mm&r=g)
       *  [watomsk](https://profiles.wordpress.org/watomsk/)  7:50 am _on_ May 3, 2015
       * Did you manage to find a solution to this? I upgraded to 4.2 and have the 
         same problem with my website.
 49.  ![](https://secure.gravatar.com/avatar/a85ac288d791e3f25aa3ca783dc65dc3f069a26ccc18d0412a3e977ce6c65f1a?
      s=32&d=mm&r=g)
 50.   [neo7](https://profiles.wordpress.org/neo7/)  12:58 pm _on_ April 26, 2015
 51.  Got this error while updating “PHPPHP The web scripting language in which WordPress
      is primarily architected. WordPress requires PHP 7.4 or higher message: WordPress
      database error Specified key was too long; max key length is 1000 bytes for query
      ALTER TABLE wp_commentmeta CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci
      made by wp_upgrade, upgrade_all, upgrade_420, maybe_convert_table_to_utf8mb4”
 52.  Now all tables are utf8mb4_unicode_ci except wp_commentmeta which is utf8_general_ci.
 53.  How to covert this table?
 54.  ![](https://secure.gravatar.com/avatar/d3024cfdd563ce8199760ef6f88433333b1bbeabe6eccb6202e58a344783fad7?
      s=32&d=mm&r=g)
 55.   [interglobalmedia](https://profiles.wordpress.org/interglobalmedia/)  1:47 am
      _on_ April 27, 2015
 56.  Hi Nihad. I had kind of a similar issue when I updated to 4.2. What is actually
      happening is that incorrect code that was previously undetected or slipped under
      the radar so to speak, has now been detected and then “erased”. I’ll give an 
      example. I was working with a theme that someone else had begun developing, and
      there was incorrect code in it. I hadn’t gone over everything yet, and did not
      realize that the theme’s sidebarSidebar A sidebar in WordPress is referred to
      a widget-ready area used by WordPress themes to display information that is not
      a part of the main content. It is not always a vertical column on the side. It
      can be a horizontal rectangle below or above the content area, footer, header,
      or any where in the theme. had not been registered or configured properly. So,
      when I updated to 4.2, I was told in the backend that my sidebar’s id had been
      incorrectly configured. Could I please manually correct it? I forget exactly 
      what I did, but when I did it, the sidebar disappeared. What was good about this
      and I saw as a real plus, was that it told me what was wrong, and then I knew
      what I had to do to fix it. i fixed it. Luckily, it was on a local installLocal
      Install A local install of WordPress is a way to create a staging environment
      by installing a LAMP or LEMP stack on your local computer.. Of course. I was 
      still developing it. Then I had another issue post 4.2 that had never come to
      the fore previously. I have a theme that uses a page template called “full width
      content”. However, I had purchased a premium pluginPlugin A plugin is a piece
      of software containing a group of functions that can be added to a WordPress 
      website. They can extend functionality or add new features to your WordPress 
      websites. WordPress plugins are written in the PHP programming language and integrate
      seamlessly with WordPress. These can be free in the WordPress.org Plugin Directory
      [https://wordpress.org/plugins/](https://wordpress.org/plugins/) or can be cost-
      based plugin from a third-party. called “Ultimate Landing Pages” back in February.
      It wasn’t quite clear what sort of template the developer used for these landing
      pages, but everything seemed to work just great. Until 4.2. Today, I went into
      one of my site’s regular pages that I had configured to “full width content a
      couple of months ago, and I noticed that it no longer ran the full page width
      that it had before 4.2! The now invisible sidebar prevented the content from 
      running the full width of the page. I thought it bizarre and went into the Editor
      to see what was going on. The Ultimate Landing Pages plugin’s template finally
      had shown up. It was configured to the “Front Page Template, which is one of 
      the WordPress “Reserved Theme File Names”, has special meaning for WordPress,
      and if present along with a custom theme template that does the same thing, it
      will take precedence. So the fact that I had both the Front Page template and
      the Full Width template which both displayed the page in the same way, caused
      the Full Width template to no longer display “properly”. I had to go into the
      Editor and change the page template to “Front Page”. This partially has to do
      with cache issues, but also 4.2 lets you know either overtly (or covertly) about
      incorrect code/configuration issues. I am going to try and find out from the 
      WordPress coreCore Core is the set of software required to run WordPress. The
      Core Development Team builds WordPress. developers what changes they made that
      made this possible. I see it as a very positive thing. Hope this helps.
 57.  ![](https://secure.gravatar.com/avatar/117491e9b1f50e3e5ef8879a5aaaca7587c2774d66a544c8c2939a7a87df8e6e?
      s=32&d=mm&r=g)
 58.   [DrLightman](https://profiles.wordpress.org/drlightman/)  10:40 am _on_ April
      27, 2015
 59.  Could this index upgrade fail or time out on databases with large tables, let
      say 250’000+ posts thus lot more postmetas?
 60.  If we do this upgrade manually let say via command line on dedicated servers,
      will WP 4.2 skip the upgrade during installation?
 61.   * ![](https://secure.gravatar.com/avatar/27180c82524020e7339e2b30818b6d8ab004c54f730f12b1434b1e365be0e175?
         s=32&d=mm&r=g)
       *  [Ipstenu (Mika Epstein)](https://profiles.wordpress.org/ipstenu/)  4:24 pm
         _on_ April 27, 2015
       * It could. I had to run the db upgrade multiple times via WP cli on a site 
         with a 100 meg wp_posts table.
          - ![](https://secure.gravatar.com/avatar/117491e9b1f50e3e5ef8879a5aaaca7587c2774d66a544c8c2939a7a87df8e6e?
            s=32&d=mm&r=g)
          -  [DrLightman](https://profiles.wordpress.org/drlightman/)  9:32 am _on_
            April 29, 2015
          - Do you have the comman to launch at hand with wp-cliWP-CLI WP-CLI is the
            Command Line Interface for WordPress, used to do administrative and development
            tasks in a programmatic way. The project page is [http://wp-cli.org/](http://wp-cli.org/)
            [https://make.wordpress.org/cli/](https://make.wordpress.org/cli/)? thank
            you
          - ![](https://secure.gravatar.com/avatar/117491e9b1f50e3e5ef8879a5aaaca7587c2774d66a544c8c2939a7a87df8e6e?
            s=32&d=mm&r=g)
          -  [DrLightman](https://profiles.wordpress.org/drlightman/)  9:33 am _on_
            April 29, 2015
          - wp coreCore Core is the set of software required to run WordPress. The 
            Core Development Team builds WordPress. update-db
          - by any chance?
             * ![](https://secure.gravatar.com/avatar/f847340cac151352b0bc321c16df9a032472b24bd496730d22dbecdaa1dbeec8?
               s=32&d=mm&r=g)
             *  [FolioVision](https://profiles.wordpress.org/foliovision/)  8:19 am
               _on_ May 7, 2015
             * We had to figure out how to do this with PHPPHP The web scripting language
               in which WordPress is primarily architected. WordPress requires PHP 
               7.4 or higher on command line: [https://foliovision.com/2015/04/wordpress-database-upgrade-4-2](https://foliovision.com/2015/04/wordpress-database-upgrade-4-2)
             * Did “wp coreCore Core is the set of software required to run WordPress.
               The Core Development Team builds WordPress. update-db” work for you 
               on WP CLICLI Command Line Interface. Terminal (Bash) in Mac, Command
               Prompt in Windows, or WP-CLI for WordPress.?
             * ![](https://secure.gravatar.com/avatar/27180c82524020e7339e2b30818b6d8ab004c54f730f12b1434b1e365be0e175?
               s=32&d=mm&r=g)
             *  [Ipstenu (Mika Epstein)](https://profiles.wordpress.org/ipstenu/)  
               1:25 pm _on_ May 7, 2015
             * Sorry, I missed this, yes, that’s the command. And yes, FolioVision,
               worked fine for me in three situations.
 62.  ![](https://secure.gravatar.com/avatar/87aadd88f079eb2c6ec96d4dd83c1d6c1cb85dbe8e41a540ea4043e7a1456577?
      s=32&d=mm&r=g)
 63.   [jtleathers](https://profiles.wordpress.org/jtleathers/)  9:56 pm _on_ April
      27, 2015
 64.  Developing a site locally on WAMP with SQL 5.6.17. When I attempt to import the
      database to a server using an older version of SQL I get the following error:
 65.  [#1273](https://core.trac.wordpress.org/ticket/1273) – Unknown collation: ‘utf8mb4_unicode_ci’
 66.  How do I properly rollback this “upgrade” from WordPress 4.2?
 67.   * ![](https://secure.gravatar.com/avatar/27180c82524020e7339e2b30818b6d8ab004c54f730f12b1434b1e365be0e175?
         s=32&d=mm&r=g)
       *  [Ipstenu (Mika Epstein)](https://profiles.wordpress.org/ipstenu/)  11:30 
         pm _on_ April 27, 2015
       * Import how? Phpmyadmin?
          - ![](https://secure.gravatar.com/avatar/a4271cef819f996729f78bd48af1a039f20d629eed0f369910bb533d289621a6?
            s=32&d=mm&r=g)
          -  [mctenold](https://profiles.wordpress.org/mctenold/)  11:55 pm _on_ April
            27, 2015
          - Same issue here – importing any way, CLICLI Command Line Interface. Terminal(
            Bash) in Mac, Command Prompt in Windows, or WP-CLI for WordPress., phpMyAdmin,
            or personally I’m using MySQLMySQL MySQL is a relational database management
            system. A database is a structured collection of data where content, configuration
            and other options are stored. [https://www.mysql.com](https://www.mysql.com/)
            Workbench for Mac and getting the same errors. For now I’m going to have
            to not use 4.2 until I can find a workflow to go from Local -> Dev Server,
            where local MySQL is compatible with 4.2 but dev server is not.
             * ![](https://secure.gravatar.com/avatar/4552a37ad88a791066d442a8d1314b1fee6f0217725504cafff10f9109876ce2?
               s=32&d=mm&r=g)
             *  [Max Sixblade](https://profiles.wordpress.org/max-sixblade/)  5:16 
               am _on_ May 4, 2015
             * True! Using XAMPP for Windows, this is definitely not a phpmyadmin issue.
               Older mysqlMySQL MySQL is a relational database management system. A
               database is a structured collection of data where content, configuration
               and other options are stored. [https://www.mysql.com](https://www.mysql.com/)
               version on remote server leads to errors while importing db. Compatibility
               modes while exporting db didn’t help in my case.
          - ![](https://secure.gravatar.com/avatar/87aadd88f079eb2c6ec96d4dd83c1d6c1cb85dbe8e41a540ea4043e7a1456577?
            s=32&d=mm&r=g)
          -  [jtleathers](https://profiles.wordpress.org/jtleathers/)  12:45 am _on_
            April 28, 2015
          - Yeah, import through PHPMyAdmin.
             * ![](https://secure.gravatar.com/avatar/27180c82524020e7339e2b30818b6d8ab004c54f730f12b1434b1e365be0e175?
               s=32&d=mm&r=g)
             *  [Ipstenu (Mika Epstein)](https://profiles.wordpress.org/ipstenu/)  
               2:59 am _on_ April 28, 2015
             * [http://sourceforge.net/p/phpmyadmin/bugs/4236/](http://sourceforge.net/p/phpmyadmin/bugs/4236/)
             * I think that’s going to be why it’s happening to you.
                - ![](https://secure.gravatar.com/avatar/a4271cef819f996729f78bd48af1a039f20d629eed0f369910bb533d289621a6?
                  s=32&d=mm&r=g)
                -  [mctenold](https://profiles.wordpress.org/mctenold/)  5:13 am _on_
                  April 28, 2015
                - This also doesn’t work for MySQLMySQL MySQL is a relational database
                  management system. A database is a structured collection of data 
                  where content, configuration and other options are stored. [https://www.mysql.com](https://www.mysql.com/)
                  Workbench on Mac.
                - ![](https://secure.gravatar.com/avatar/87aadd88f079eb2c6ec96d4dd83c1d6c1cb85dbe8e41a540ea4043e7a1456577?
                  s=32&d=mm&r=g)
                -  [jtleathers](https://profiles.wordpress.org/jtleathers/)  5:14 am
                  _on_ April 28, 2015
                - Thanks for looking into it for me. Unfortunately that wouldn’t apply
                  to my situation as it is an issue with PHPMyAdmin version 4.1 and
                  this server is running 3.5.
             * ![](https://secure.gravatar.com/avatar/27180c82524020e7339e2b30818b6d8ab004c54f730f12b1434b1e365be0e175?
               s=32&d=mm&r=g)
             *  [Ipstenu (Mika Epstein)](https://profiles.wordpress.org/ipstenu/)  
               1:47 pm _on_ April 28, 2015
             * At 3.5, you may be too old for the new charset: [http://sourceforge.net/p/phpmyadmin/bugs/3619/](http://sourceforge.net/p/phpmyadmin/bugs/3619/)
             * Try 4.0
                - ![](https://secure.gravatar.com/avatar/a4271cef819f996729f78bd48af1a039f20d629eed0f369910bb533d289621a6?
                  s=32&d=mm&r=g)
                -  [mctenold](https://profiles.wordpress.org/mctenold/)  5:38 pm _on_
                  April 28, 2015
                - The solution of updating phpMyAdmin or MySQLMySQL MySQL is a relational
                  database management system. A database is a structured collection
                  of data where content, configuration and other options are stored.
                  [https://www.mysql.com](https://www.mysql.com/) on the clients servers
                  isn’t a good one, a lot of times that is not possible, mainly with
                  shared hosting plans.
          - ![](https://secure.gravatar.com/avatar/10c63188f8d92352b1dfcf9493df0d8f5de16fa24a80c7b5da2fd579b2b0fff3?
            s=32&d=mm&r=g)
          -  [MBWD](https://profiles.wordpress.org/mbwd/)  3:23 pm _on_ May 16, 2015
          - I am having the same problem with my shared hosting server, which is using
            an older version of PHPPHP The web scripting language in which WordPress
            is primarily architected. WordPress requires PHP 7.4 or higher. The upgrade
            to 4.2 apparently went fine for sites already hosted, but importing a db
            with utf8mb4 doesn’t work. I tried downgrading my version of WP to 4.0 
            and upgrading the database (which I thought would revert the charset) but
            it didn’t work. Manually replacing didn’t work either.
 68.  ![](https://secure.gravatar.com/avatar/a4271cef819f996729f78bd48af1a039f20d629eed0f369910bb533d289621a6?
      s=32&d=mm&r=g)
 69.   [mctenold](https://profiles.wordpress.org/mctenold/)  12:54 am _on_ April 28,
      2015
 70.  I’m in the same boat as [@jtleathers](https://profiles.wordpress.org/jtleathers/),
      my typical workflow is to install WordPress locally for a new site, build the
      site locally, and then move everything to a dev or production server once I’m
      at a good place.
 71.  The issue comes in when my client’s dev or production server has a MySQLMySQL
      MySQL is a relational database management system. A database is a structured 
      collection of data where content, configuration and other options are stored.
      [https://www.mysql.com](https://www.mysql.com/) version 5.5.3. I get the same
      error upon attempting to import the database: Unknown collation: ‘utf8mb4_unicode_ci’.
 72.  This seems like a misstep of an upgrade, I think my workflow is pretty common
      practice and will affect a lot of people. I don’t think it’s common to install/
      develop the site on the production server.
 73.  Any remedy for my dilemma?
 74.  Seems like the only possible fix right now is to downgrade my local MySQL version,
      or not use WordPress 4.2.
 75.  🙁
 76.   * ![](https://secure.gravatar.com/avatar/87aadd88f079eb2c6ec96d4dd83c1d6c1cb85dbe8e41a540ea4043e7a1456577?
         s=32&d=mm&r=g)
       *  [jtleathers](https://profiles.wordpress.org/jtleathers/)  9:46 pm _on_ April
         28, 2015
       * I posted a possible solution here: [https://wordpress.org/support/topic/unknown-collation-utf8mb4_unicode_ci?replies=13#post-6884250](https://wordpress.org/support/topic/unknown-collation-utf8mb4_unicode_ci?replies=13#post-6884250)
          - ![](https://secure.gravatar.com/avatar/a4271cef819f996729f78bd48af1a039f20d629eed0f369910bb533d289621a6?
            s=32&d=mm&r=g)
          -  [mctenold](https://profiles.wordpress.org/mctenold/)  10:25 pm _on_ April
            28, 2015
          - Thanks [@jtleathers](https://profiles.wordpress.org/jtleathers/) I’ll give
            it a shot.
          - It’s like WordPress didn’t think this update through, there should at least
            by an option during installation that is like a checkbox that says “Try
            to use utf8mb4” so you can opt.
             * ![](https://secure.gravatar.com/avatar/87aadd88f079eb2c6ec96d4dd83c1d6c1cb85dbe8e41a540ea4043e7a1456577?
               s=32&d=mm&r=g)
             *  [jtleathers](https://profiles.wordpress.org/jtleathers/)  10:29 pm 
               _on_ April 28, 2015
             * I agree, there should be a way to prevent WordPress from automatically
               making this change to the database.
          - ![](https://secure.gravatar.com/avatar/4552a37ad88a791066d442a8d1314b1fee6f0217725504cafff10f9109876ce2?
            s=32&d=mm&r=g)
          -  [Max Sixblade](https://profiles.wordpress.org/max-sixblade/)  4:48 am 
            _on_ May 4, 2015
          - Didn’t work for me. I’ve tried all the possible compatibility modes but..
            no luck. That helped ecaping errors while importing DB (on a remote server)
            but I’ve got a lot of ?????? ?? instead.
       * ![](https://secure.gravatar.com/avatar/4552a37ad88a791066d442a8d1314b1fee6f0217725504cafff10f9109876ce2?
         s=32&d=mm&r=g)
       *  [Max Sixblade](https://profiles.wordpress.org/max-sixblade/)  4:42 am _on_
         May 4, 2015
       * Totally agree with you! Same issue for me. I’ve spent like 6 hours trying 
         to push 4.2 WordPress to the server with mysqlMySQL MySQL is a relational 
         database management system. A database is a structured collection of data 
         where content, configuration and other options are stored. [https://www.mysql.com](https://www.mysql.com/)
         5.1 . I’ve tryied every possible solutions but ..no luck. Why not implement
         a checkbox ..like install in utf8 (instread of utf8mb4). Let it be not checked
         by default, but that’ld have saved the day.
 77.  ![](https://secure.gravatar.com/avatar/a963099997070a287232ae4379b318c3f034267d3e474cf49569b1870017fcdb?
      s=32&d=mm&r=g)
 78.   [dustinbolton](https://profiles.wordpress.org/dustinbolton/)  10:20 pm _on_ 
      May 6, 2015
 79.  BackupBuddy developer here: It is absolutely INCORRECT to say that migrating 
      sites to new server is uncommon. BackupBuddy helps users move several hundred
      thousand sites per year to new servers.
 80.  We are already seeing a flood of users encountering this problem attempting to
      move their site to new servers with older MySQLMySQL MySQL is a relational database
      management system. A database is a structured collection of data where content,
      configuration and other options are stored. [https://www.mysql.com](https://www.mysql.com/)
      versions. They of course are puzzled why this is a problem since WordPress states
      it supports this older MySQL version.
 81.  Many users these days practice things such as local development, staging, etc
      which are good modern practices. WordPress has effectively put a huge thorn in
      the sides of developers and in my opinion has made an extremely big mistake.
 82.  ![](https://secure.gravatar.com/avatar/475a0c63e101ffcbe15ab11580a9aa9aeeadb2805bfaec45cc5f9a53e4f72c7d?
      s=32&d=mm&r=g)
 83.   [lucaboccianti](https://profiles.wordpress.org/lucaboccianti/)  6:38 pm _on_
      May 11, 2015
 84.  I may have found a possible walkaround.
 85.  I’m in the same situation and problem as above: develop locally with xampp then
      upload on the production server (mostly shared hosting).
 86.  with phpmyadmin for each table edit each field codified with utf8mb4-something
      to be codified as utf8-something (select the table, then Structure, etc.). then
      edit the table properties (Operations) and do the same.
 87.  finally export the dump and restore it on the production server.
 88.  it’s long and painful but maybe better than restart a project from scratch.
 89.  ![](https://secure.gravatar.com/avatar/475a0c63e101ffcbe15ab11580a9aa9aeeadb2805bfaec45cc5f9a53e4f72c7d?
      s=32&d=mm&r=g)
 90.   [lucaboccianti](https://profiles.wordpress.org/lucaboccianti/)  6:49 pm _on_
      May 11, 2015
 91.  problems: you’ll end with all the extended characters looking funny and apparently
      the text edit area appear blank even if the text is visible on the frontend.
 92.  ![](https://secure.gravatar.com/avatar/4552a37ad88a791066d442a8d1314b1fee6f0217725504cafff10f9109876ce2?
      s=32&d=mm&r=g)
 93.   [Max Sixblade](https://profiles.wordpress.org/max-sixblade/)  11:36 pm _on_ 
      May 11, 2015
 94.  So.. where shall we vote to get that “install in default UTF-8” checkbox on WP
      installation?)
 95.  ![](https://secure.gravatar.com/avatar/607c6b260c5e485442be16d8598d288d5e719a5c938dfe3d8ae82f3239b13fa0?
      s=32&d=mm&r=g)
 96.   [Ben Lobaugh (blobaugh)](https://profiles.wordpress.org/blobaugh/)  1:44 pm 
      _on_ May 12, 2015
 97.  I have had several migrations happen this week, and even between the dev, staging,
      and production servers. Ran into lots of issues and what I wound up doing is 
      running a script to convert the database back to utf8. This worked great to get
      the data imported and the next time wp-adminadmin (and super admin) was loaded
      the database was successfully updated with the security patchpatch A special 
      text file that describes changes to code, by identifying the files and lines 
      which are added, removed, and altered. It may also be referred to as a **diff**.
      A patch can be _applied_ to a codebase for testing..
 98.  If interested here is the script I used [http://ben.lobaugh.net/blog/201740/script-to-convert-mysql-collation-from-utf8mb4-to-utf8](http://ben.lobaugh.net/blog/201740/script-to-convert-mysql-collation-from-utf8mb4-to-utf8)
 99.   * ![](https://secure.gravatar.com/avatar/6dcbb56b3a2af88b5473a1faf23d04f7715fee93d509f5b1f2d38e780c11c898?
         s=32&d=mm&r=g)
       *  [dblomster](https://profiles.wordpress.org/dblomster/)  3:23 pm _on_ May 
         12, 2015
       * Nice! What about table indexes and such? Is there anything else that need 
         to be changed when going from utf8mb4 to utf8 again?
          - ![](https://secure.gravatar.com/avatar/607c6b260c5e485442be16d8598d288d5e719a5c938dfe3d8ae82f3239b13fa0?
            s=32&d=mm&r=g)
          -  [Ben Lobaugh (blobaugh)](https://profiles.wordpress.org/blobaugh/)  4:
            54 pm _on_ May 12, 2015
          - All I did was run that and it magic worked. Before running that script 
            the db was complaining when I tried to import via sql files.
          - ![](https://secure.gravatar.com/avatar/10c63188f8d92352b1dfcf9493df0d8f5de16fa24a80c7b5da2fd579b2b0fff3?
            s=32&d=mm&r=g)
          -  [MBWD](https://profiles.wordpress.org/mbwd/)  4:00 pm _on_ May 16, 2015
          - Hi Ben, I’m also on a Mac and have saved this script you so thoughtfully
            provided as a .sh file to run through Terminal, but when I run it I am 
            getting an error saying “mysqlMySQL MySQL is a relational database management
            system. A database is a structured collection of data where content, configuration
            and other options are stored. [https://www.mysql.com](https://www.mysql.com/):
            command not found”. Any idea what could be wrong?
       * ![](https://secure.gravatar.com/avatar/e7682941dde49ca02a77677974ffbbda5f3d45cb8960cd40b087a66749fb7613?
         s=32&d=mm&r=g)
       *  [dotwongdotcom](https://profiles.wordpress.org/dotwongdotcom/)  4:40 pm _on_
         May 12, 2015
       * Ben! Thanks for this! You may have just saved me a huge headache. I stumbled
         upon your post through a rabbit hole of clicking while trying to figure out
         a workaround for errors that I was encountering while using the migrationMigration
         Moving the code, database and media files for a website site from one server
         to another. Most typically done when changing hosting companies. tool BackupBuddy.
         My local dev is running WP 4.2, but the migration won’t allow utf8mb4 on the
         live site because their version of mysqlMySQL MySQL is a relational database
         management system. A database is a structured collection of data where content,
         configuration and other options are stored. [https://www.mysql.com](https://www.mysql.com/).
         I’m a relative novice when it comes to these things… how would I implement
         your script to convert my local build’s tables back to utf8 so that I can 
         migrate to my live server?
          - ![](https://secure.gravatar.com/avatar/607c6b260c5e485442be16d8598d288d5e719a5c938dfe3d8ae82f3239b13fa0?
            s=32&d=mm&r=g)
          -  [Ben Lobaugh (blobaugh)](https://profiles.wordpress.org/blobaugh/)  9:
            09 pm _on_ May 12, 2015
          - Copy it into a bash script on your local dev. Edit the variables for db
            access and run it from the terminal. This assumes you are on a unix based
            system such as Linux or OS X. I do not have Windows to know how to build
            a script for that.
 100. ![](https://secure.gravatar.com/avatar/a91c455571ad14453039b98434a37c16e6993f98988b4361cb4272db8b2419ee?
      s=32&d=mm&r=g)
 101.  [zanozik](https://profiles.wordpress.org/zanozik/)  1:38 am _on_ June 23, 2015
 102. Server version: 5.5.19-cll
       MySQLMySQL MySQL is a relational database management
      system. A database is a structured collection of data where content, configuration
      and other options are stored. [https://www.mysql.com](https://www.mysql.com/)
      client version: 5.5.33 Upgraded to 4.2.2 and my wp “crashed”. Every option that
      was in unicode was either unavailable or missing non-latin chars. Pages and posts
      content was unviewable. Titles were gibberish. Since I use a web hosting (no 
      root, or cpanel access) with remote phpmyadmin I logged in there to see that 
      all of the tables collation have been changed to utf8mb4-general. Database collation
      was still utf8-general, strange, I thought. The hosting I use, let a user create/
      change a database in custom interface only. Rather popular solution. So I thought
      maybe the upgrade was only partly successful and the database was not charset
      was not actually upgraded, just collation changed. So I changed charset in wp-
      config, changed collations for each tables, and voalia – everything working again…
      Could that buggy force upgrade happen to “omg-so-professional” WordPress? I just
      dont know what to do, laugh or cry right now…
 103. ![](https://secure.gravatar.com/avatar/c60090daf16b566f8f4e5699473061b3c89e541c5d316f5c1d167886f4ba1192?
      s=32&d=mm&r=g)
 104.  [physalis](https://profiles.wordpress.org/physalis/)  11:20 pm _on_ July 2, 
      2015
 105. [@zanozik](https://profiles.wordpress.org/zanozik/) I had the exact same problem,
      only when I changed from a dev to the final server – every little special character
      was nuked, plus options and posts in the backend where cracked. I tried setting
      my dev server database, but to no avail (so I already thought it must be the 
      files then).
       Your description helped me save a release date for that project
      tomorrow morning and thus quite some people around it ;). So thanks a bunch!
 106. ![](https://secure.gravatar.com/avatar/d718cd09a356607c9c5052d45f7e8c79c84f80f28e1a5f98ae3fbfa38582235c?
      s=32&d=mm&r=g)
 107.  [treavioli](https://profiles.wordpress.org/treavioli/)  8:34 am _on_ July 10,
      2015
 108. I encountered this issue when I tried to export my database tables via phpmyadmin.
      I would get several errors and warnings about collation. I switched to Sequel
      Pro and exported/imported that way, but I’m still not without issues. My post
      editor won’t recognize posts/pages/etc I created before site migrationMigration
      Moving the code, database and media files for a website site from one server 
      to another. Most typically done when changing hosting companies.. Nothing appears
      in the edit panel for either Visual or Text tab..

Comments are closed.

# Post navigation

[← Release leads for WordPress 4.3 and 4.4](https://make.wordpress.org/core/2015/04/01/release-leads-for-wordpress-4-3-and-4-4/)

[Reminder: Term splitting in 4.2 →](https://make.wordpress.org/core/2015/04/02/reminder-term-splitting-in-4-2/)