MySQL の照合修復: 列レベルのエンコーディングの課題

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

プラットフォームについて: Data Center - この記事は、Data Center プラットフォームのアトラシアン製品に適用されます。

このナレッジベース記事は製品の Data Center バージョン用に作成されています。Data Center 固有ではない機能の Data Center ナレッジベースは、製品のサーバー バージョンでも動作する可能性はありますが、テストは行われていません。サーバー*製品のサポートは 2024 年 2 月 15 日に終了しました。サーバー製品を利用している場合は、アトラシアンのサーバー製品のサポート終了のお知らせページにて移行オプションをご確認ください。

*Fisheye および Crucible は除く

This document is part of the guide on How to Fix the Collation and Character Set of a MySQL Database. Please refer to that page for more information.

目次

Before Proceeding

Before proceeding, ensure that you:

  • Have shut down Confluence
  • Have completed a full database backup

You may also wish to apply these changes in a test environment before applying them to production.

When to apply this fix

If you notice that your content is not displaying correctly, you should apply this fix. For example, if you have the string José that is being displayed as José, that is an example of when to apply this fix.

Repairing a column with incorrectly encoded content

You'll need to select the column converting to the previousEncoding (such as latin1) and cast it to binary; then to utf8.

Setting SQL_SAFE_UPDATES to 0 before issuing the query allows you to update each row in the table. This is potentially unsafe, and should be tested thoroughly before being applied to a production system.

SET SQL_SAFE_UPDATES=0;
UPDATE tableName SET columnName = CONVERT(CAST(CONVERT(columnName USING previousEncoding) AS BINARY) USING utf8);
SET SQL_SAFE_UPDATES=1;

Depending on the character and how it's encoded, this query may not be enough to resolve the encoding issues you're seeing. You may wish to try one of the alternative methods outlined in the "Further Reading" section below.

その他の情報:

最終更新日: 2024 年 12 月 31 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.