• Hi, I develop locally using MAMP Pro and am looking to upgrade my WP databases from MySQL 5.7 to 8 and am getting warnings about converting utf8 to utf8mb3 and am wondering how to go about doing this and if this is some procedure that will cause a bunch of problems? I am pretty sure this is only a problem with my localhost DBs.

    I see in phpMyAdmin there is a collation option under operations where I can change all table collations from utf8_general_ci to utf8mb4_general_ci but I don’t see mb3 as an option.

    • This topic was modified 1 month, 4 weeks ago by wyclef.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Moderator bcworkz

    (@bcworkz)

    utf8mb3 is somewhat obsolete because the full UTF-8 charset ranges beyond 3 byte encoding. There are a good number of 4 byte encodings (mainly for Vietnamese glyphs). If you don’t have any 4 byte encoded characters in your content, it will not matter much if you use mb3 or mb4. All the same, I recommend setting all collations to some form of utf8mb4. utf8mb4_general_ci would be fine.

    Be aware that your overall DB has its own collation setting, as does every table, and every textual field within any table. Unless there’s good reason not to, they all should be the same collation. Also, your wp-config.php file has a collation setting. It should either be empty or match the collations of your DB.

    Thread Starter wyclef

    (@wyclef)

    Most of my configs look as follows. Is this incorrect?

    define(‘DB_CHARSET’, ‘utf8’);
    define(‘DB_COLLATE’, ”);

    Also, what would be the best way to go about this, just the phpMyAdmin collation option and some universal switch to utf8mb4_general_ci? Aside from the site breaking, what would I even look for or test for to make sure this didn’t mess things up?

    Moderator bcworkz

    (@bcworkz)

    Assuming your DB is using some form of UTF-8 character encoding, as it would normally be by default, then your config settings are correct. The forum’s parser corrupted the quotes (changed to the ‘curly’ style) in your reply here. The quotes in your config file are presumably the 'straight' kind, as they should be.

    There’s probably some awesome SQL query that’ll update all collation settings in one go, but I don’t know what that would be. All I know how to do is doing it manually in phpMyAdmin. Changing collation in a DB with only the default tables isn’t too big of a task. If you have a multisite installation or a lot of added tables due to plugins, the task can get to be rather significant.

    As I said, the overall DB has a collation setting (operations tab). Every table does as well (table operations tab). Every textual column in any table does as well. Fortunately, the table collation field has a check box where you can tell it to update all columns when you update the table collation.

    Thread Starter wyclef

    (@wyclef)

    Ok, I see the collation field options in table operations. I duplicated a DB and tested out changing the collation of everything. It seems fairly harmless. If it seems like my site runs fine and I can login to the dashboard and nothing appears broken is that basically it? Is there even a need to worry about upgrading from MySQL 5.7 to 8 for local development? Should I just leave everything in 5.7 and not sweat it right now?

    Moderator bcworkz

    (@bcworkz)

    For local dev, 5.7 will function properly, but when this DB is exported to a production server running 8.0+ there could be issues. In theory it should work OK, but ideally the versions would match.

    Another reason for using close to the latest version is older versions could have security vulnerabilities that remain unpatched. Not as much of concern if your local environment is isolated from outside access, but it’s still possible malware could find its way onto your local server via your browser.

    IMO upgrading for local dev is not an urgent need, but I wouldn’t completely ignore it either.

    Thread Starter wyclef

    (@wyclef)

    Thanks for the info. Wondering if the following makes sense to you? Do I just ignore this?

    Zero Date, Datetime, and Timestamp values
    Warning: By default zero date/datetime/timestamp values are no longer allowed in MySQL, as of 5.7.8 NO_ZERO_IN_DATE and NO_ZERO_DATE are included in SQL_MODE by default. These modes should be used with strict mode as they will be merged with strict mode in a future release. If you do not include these modes in your SQL_MODE setting, you are able to insert date/datetime/timestamp values that contain zeros. It is strongly advised to replace zero values with valid ones, as they may not work correctly in the future. Link

    Level Object Description
    Warning wp.wp_comments.comment_date column has zero default value: 0000-00-00 00:00:00
    Warning wp.wp_comments.comment_date_gmt column has zero default value: 0000-00-00 00:00:00
    Warning wp.wp_links.link_updated column has zero default value: 0000-00-00 00:00:00
    Warning wp.wp_posts.post_date column has zero default value: 0000-00-00 00:00:00
    Warning wp.wp_posts.post_date_gmt column has zero default value: 0000-00-00 00:00:00
    Warning wp.wp_posts.post_modified column has zero default value: 0000-00-00 00:00:00
    Warning wp.wp_posts.post_modified_gmt column has zero default value: 0000-00-00 00:00:00
    Warning wp.wp_users.user_registered column has zero default value: 0000-00-00 00:00:00
Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.