Confluence should use an external database for production usage, as the embedded database does not offer full transactional integrity in the event of sudden power loss. Confluence Standalone with mySQL is well-tested and easily configured for production.
This document outlines setting up Confluence with the open-source MySQL database on Microsoft Windows, migrating across any existing content. To migrate to another database such as Oracle, follow this guide instead.
Install the following software:
- Install Confluence if you have not done so already.
- Install the mySQL MySQL 'Community' Database Server, version 4.1.x, from the mySQL download page. This install includes mySQL Administrator. We don't currently support MySQL 5.
- Download the latest mySQL Connector/J driver, version 3.1 or newer.
The instructions refer to two particular directories:
- The
Confluence Installation Directory
is the directory where you unzipped the Confluence install download.
- The
Confluence Home Directory
is the directory where Confluence stores its data, which you set by editing the confluence-init.properties
file in Confluence Installation Directory/confluence/WEB-INF/classes
データベースおよびユーザー権限を作成するには:
- Start the MySQL Adminstrator and use it connect to the mySQL database server. If you are running mySQL for the first time and are unsure of the login settings, just click OK to connect using the defaults.
- Go to User Administration and click the 'New User' button at the bottom of the window.
- Call the user 'confluenceuser' and give them a password, click 'Apply Changes'.
- Right click on the name 'confluenceuser' and choose 'Add Host From Which The User Can Connect' from the pop-up menu. Enter the host 'localhost'.
- Go to Catalogs, right click in the schema list at the bottom of the left hand column of the window, and select 'Create New Schema' from the pop-up menu. Call the new Schema 'confluencedb'.
- Go back to User Adminstration, click on 'confluenceuser' text, not the icon. Then select the 'localhost' which appears under 'confluenceuser' . Now go to the Schema Privileges tab located on the RHS of the window. Here select confluencedb, and make sure the user has all priviledges assigned to them by clicking the '<<' button to move the priviledges from the 'Available' to the 'Assigned' list. Click "Apply Changes".
This stage is only required if you have existing Confluence content you wish to transfer:
- Manually create an XML backup of Confluence under Administration -> Backup & Restore. If you have less than 100MB of attachments, check 'Backup attachments' when creating the backup. If you have over 100MB of attachments, you should not check the 'Backup attachments' and instead you should manually copy the /attachments directory in your Confluence home to another location. This attachments directory can then be copied into the new home directory as describe later
- Download the backup file to a backups folder
- Confluence を停止します。
- Open your Confluence home directory and copy the plugins subdirectory to the backups folder
To switch to using the external database:
- Confluence を停止します。
- Edit
Confluence Installation Directory/WEB-INF/classes/confluence-init.properties
and change the confluence.home
property to point to a new directory. e.g. if you had
confluence.home=c:/confluencedata
You could change it to:
confluence.home=c:/confluencedata_mysql
This is your new Confluence Home Directory
. (The name doesn't have to end in _mysql – that's just an example)
- Copy the file
mysql-connector-java-3.1.xx-bin.jar
from the directory where you unpacked Connector/J to Confluence Installation Directory/WEB-INF/lib
. (the xx
depends on exactly which version you download – MySQL updates the version number from time to time)
- Start Confluence and set up the new configuration
- You'll be asked for your licence key again. Enter it, and click the 'Custom Installation' button.
- Under the 'External Database' heading, choose MySQL from the dropdown list and click the 'External Database' button.
- On the next page, click the 'Direct JDBC' button.
- Change the database URL by changing the database name 'confluence' to 'confluencedb', so the URL looks like this:
jdbc:mysql://localhost/confluencedb?autoReconnect=true
- Enter
confluenceuser
in the User Name field, and the password you chose earlier in the Password field
- Click the Next button. If you get the error message
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)'
verify that you have properly given the confluenceuser user all the right permissions when connecting from localhost
To re-import your backup and plugins:
- At the 'Load Content' page, choose 'Restore From Backup', browse for the backup you created and restore it. Otherwise choose either the example or empty site as you wish.
- Confluence を停止します。
- Open your backups folder and copy the plugins subdirectory to the new Confluence home directory
Done!
Configuring Database Character Encoding
Known Issues for MySQL