This page provides instructions for configuring Confluence to use the MySQL database.

ステップ 1. 前提条件を確認する

始める前に、以下の内容を確認します:

ステップ 2. MySQL サーバーをインストールする

If you do not already have an operational MySQL database server, install 'MySQL Community Edition'. Download the installation package from the MySQL download page and follow the instructions in the MySQL documentation.

ステップ 3. MySQL サーバーを設定する

このステップでは、お使いの MySQL データベースサーバーを設定します。

注意:Confluence を既存の MySQL データベースサーバーに接続する場合、以下の説明に従って MySQL インストールウィザードで設定ステップを実行し、このデータベースサーバーを再設定することを強くお勧めします

MySQL サーバーを設定するには:

  1. MySQL インストレーションウィザードを実行します:
    1. Confluence を既存の MySQL サーバーに接続している場合、インスタンス再設定を選択します。
    2. 高度な設定 (Advanced Configuration) を選択します。
    3. Choose the type of MySQL Server that best suits your hardware requirements. This will affect the MySQL Server's usage of memory, disk and CPU resources. Refer to the MySQL documentation for further information.
    4. トランザクション データベースのみを選択して、お使いの MySQL データベースがそのデフォルト ストレージ エンジンとして InnoDB を利用する事を保証します。
      Confluence とは、InnoDB ストレージエンジンのみを利用する事を強くお勧めします。MyISAM ストレージ エンジンを利用するとデータ破損を引き起こす可能性があるため、その利用は控えて下さい。
    5. 要件に InnoDB テーブルスペース設定を行います (デフォルト設定でも可能です)。
    6. Set the approximate number of concurrent connections permitted to suit your Confluence usage requirements. You can use one of the presets or enter a number manually. Refer to the MySQL documentation for further information.
    7. For the networking options, ensure the Enable TCP/IP Networking and Enable Strict Mode options are selected (default). Refer to the MySQL documentation on setting the networking and server SQL modes for further information.
    8. MySQL サーバーのデフォルトのキャラクターセットに関しては、Best Support For Multilingualism (いわば、UTF-8) を選択します。これによって、国際化に対する Confluence のサポートが保証されます。詳しくはデータベース文字エンコード設定を参照して下さい。
    9. For the Windows configuration option, choose whether or not to install the MySQL Server as a Windows service. If your hardware is going to be used as a dedicated MySQL Server, you may wish to choose the options to Install As Windows Service (and Launch the MySQL Server automatically). Refer to the MySQL documentation for further information.
      Note: If you choose not to install the MySQL Server as a Windows Service, you will need to ensure that the database service has been started before running Confluence.
    10. セキュリティ設定を修正するを選択して、MySQL サーバー (ルート) アクセスパスワードの入力と設定を行います。
  2. Edit the my.cnf file (my.ini on Windows operating systems) in your MySQL server. Locate the [mysqld]section in the file, and add or modify the following parameters:
    (Refer to MySQL Option Files for detailed instructions on editing my.cnf and my.ini.)
    Locate the [mysqld]section in the file, and add or modify the following parameters:
    • UTF-8 となるデフォルトのキャラクタセットを指定します:

      [mysqld]
      ...
      character-set-server=utf8
      collation-server=utf8_bin
      ...
      
    • デフォルトのストレージエンジンを InnoDB に設定します:

      [mysqld]
      ...
      default-storage-engine=INNODB
      ...
      
    • max_allowed_packet の値が 40 M 以上になるように指定します。

      [mysqld]
      ...
      max_allowed_packet=40M
      ...
      
    • sql_mode パラメーターが NO_AUTO_VALUE_ON_ZERO に指定されていないことを確認します。

      // remove this if it exists
      sql_mode = NO_AUTO_VALUE_ON_ZERO
  3. 変更内容を有効にするには、MySQL サーバーを再起動します:
    • Windows 上では、Windows サービスマネージャーを利用してサービスを再起動します。
    • Linux の場合
      • お使いのセットアップに応じて、以下のコマンドを実行します: "/etc/init.d/mysqld stop"、"/etc/init.d/mysql stop”、"service mysqld stop"。
      • 次に "stop" を "start" に置き替えて同じコマンドを再び実行します。
    • Mac OS X の場合、sudo /Library/StartupItems/MySQLCOM/MySQLCOM restart を実行します。

ステップ 4. MySQL データベースおよびユーザーのセットアップ

このステップでは、お使いの Confluence データを保持するデータベースを MySQL 内に作成し、そのデータベースにアクセスする権限のあるデータユーザーを作成します。

データベースおよびユーザー権限を作成するには:

  1. mysql コマンドを MySQL のスーパー ユーザーとして実行します。既定ユーザーは "root" でパスワードはブランクです。
  2. 次のコマンドを実行して、空の Confluence データベースのスキーマを作成します:

    CREATE DATABASE confluence CHARACTER SET utf8 COLLATE utf8_bin;
  3. 次のコマンドを実行して、Confluence データベースユーザーを作成します。'confluenceuser' と 'confluencepass' を、お好きなユーザー名とパスワードに置き替えます。 お使いの MySQL データベースサーバーと同じサーバー上で Confluence が実行されていない場合、'localhost' を Confluence サーバーのホスト名もしくは IP アドレスと置き替えます:

    GRANT ALL PRIVILEGES ON confluence.*TO 'confluenceuser'@'localhost' IDENTIFIED BY 'confluencepass';

ステップ 5. Confluence をインストールする

まだ行っていないのであれば、Confluence をインストールしましょう。Confluence インストールガイドを参照して下さい。お使いのブラウザで Confluence セットアップウィザードを開く前に、インストレーション後すぐに中断して次のステップに従います。

既に Confluence セットアップウィザードの途中まで進んだ場合、データベースセットアップのステップで止めて、以下のステップに従います。後で、同じ所から再びセットアップウィザードを再開できます。

ステップ 6. MySQL データベースドライバーのダウンロードおよびインストール

Confluence を新しいバージョンにアップグレードする際に、既に推奨 MySQL ドライバー (JDBC Connector/J 5.1) を利用しているのであれば、このセクションの内容を飛ばして結構です。Confluence アップグレードタスクは、アップグレードされたインストレーションにあなたの既存のドライバーを自動的にコピーしてくれます。

Confluence をインストールしているか、あるいは Confluence をアップグレードしていて推奨 MySQL ドライバー (JDBC Connector/J 5.1)を利用していないのであれば、以下のステップに従います。

お使いの環境に合わせて、MySQL への JDBC直接接続あるいはデータソースへの接続 のどちらをセットアップするか選択します。不明であれば、JDBC への直接接続を選択します。

JDBC への直接接続をセットアップするには:

MySQL に対する JDBC の直接接続をセットアップする予定であれば、MySQL JDBC ドライバーをお使いの Confluence インストレーションにコピーする必要があります。

  1. MySQL ドライバーを取得します:
    • If you are installing Confluence, download the recommended MySQL driver . Links to the appropriate database drivers are available on this page: Database JDBC Drivers.
      You can download either the .tar.gz or the .zip archive. Extract the driver JAR file (for example, mysql-connector-java-x.x.x-bin.jar, where x.x.x is a version number) from the archive.
    • If you are upgrading Confluence to a later version, and you are not using the recommended MySQL driver (JDBC Connector/J 5.1), copy the driver JAR file from your existing Confluence installation before you upgrade. The driver will be in the <Confluence installation> /confluence/WEB-INF/lib folder.
  2. Copy the driver JAR file to the  <Confluence installation> /confluence/WEB-INF/lib folder in your new or upgraded Confluence installation.

データソース接続をセットアップするには:

MySQL へのデータソース接続をセットアップするのであれば、MySQL データベース を Apache Tomcat 設定において解説されたステップに従います。

ステップ 7. 国際化の設定を確認する

If you are using a existing database, use the status command to verify database character encoding information. The results should be UTF-8. See Configuring Database Character Encoding.

ステップ 8. Confluence セットアップウィザードにおいてデータベース接続をセットアップする

Confluence を起動して、お使いのブラウザの Confluence セットアップウィザードに行きます。ステップに従い、新しい設定をセットアップします:

  1. Confluence セットアップガイドにおける最初のステップに従います。
  2. 評価用インストールもしくは本番環境用インストールの選択を求められたときは、本番環境を選択します。
  3. 組み込みデータベースまたは外部データベースを選択するようにプロンプトが出されたら、ドロップダウンリストから MySQL を選択して、外部データベースを選択します。
    (注意:ドライバーが必要ですという警告が表示されます。ドライバーはステップ 6 でダウンロード済みまたはコピー済みなので、この警告は無視できます。 
  4. 先ほど MySQL データベースドライバーをセットアップした際の選択と合うように、JDBC 直接接続もしくはデータソース接続を選択します。
    • For the JDBC connection: Enter the username (for example, confluenceuser) and password you chose earlier. 
    • For a datasource connection: Set the JNDI name to java:comp/env/jdbc/confluence

おめでとうございます!Confluence は、そのデータ保管に MySQL データベースを利用するようになりました。

トラブルシューティング

  • 次のエラー メッセージが表示された場合は、localhost から接続する際に必要となる全てのデータベース権限を confluenceuser ユーザーに付与したかどうかを確認します。

    Could not successfully test your database: : Server connection failure during transaction. Due to underlying exception: 'java.sql.SQLException: Access denied for user 'confluenceuser'@'localhost' (using password: YES)'
  • Confluence がクラスファイルを欠いていると訴えた場合は、JDBC ドライバーを誤ったフォルダに配置した可能性があります。
  • If none of the above describes your issue, please create a support ticket at http://support.atlassian.com and be sure to include your logs (found in <CONFLUENCE-INSTALLATION>/logs and <CONFLUENCE-HOME>/logs).
  • ラベルなし