MySQL Collation Repair: Database Level Changes

お困りですか?

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

コミュニティに質問

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.

目次

使用可能な照合

Not all versions of Confluence support utf8mb4 (which provides support for 4-btye characters). You may need to use utf8.

utf8mb4 を使用可能 utf8 の使用が必須
  • MySQL 5.7.9 以降で実行されている Confluence 7.3 以降
  • Confluence 7.2 以前
  • Any Confluence versions running on MySQL 5.6

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.

Identifying the Collation and Character set of your database

以降の例で、次のように変更します。 

  • <yourDB>: 実際のデータベース名
  • <charset>: utf8 または utf8mb4
  • <collation>: utf8_bin または utf8mb4_bin

次のクエリを実行します。

SELECT DEFAULT_CHARACTER_SET_NAME, DEFAULT_COLLATION_NAME FROM information_schema.SCHEMATA S
WHERE schema_name = '<yourDB>'
AND 
(
	DEFAULT_CHARACTER_SET_NAME != '<charset>'
	OR
	DEFAULT_COLLATION_NAME != '<collation>'
);

This query will return a list of each database that is not using the correct character set and collation.

Fixing the collation for the database

以降の例で、次のように変更します。 

  • <yourDB>: 実際のデータベース名
  • <charset>: utf8 または utf8mb4
  • <collation>: utf8_bin または utf8mb4_bin

次のクエリを実行します。

ALTER DATABASE <yourDB> CHARACTER SET <charset> COLLATE <collation>

例:

ALTER DATABASE confluence CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
最終更新日: 2020 年 2 月 4 日

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

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