KB : Connect Jira with PostgreSQL Database

This is a very simple solution (and slightly opinionated), that involves using https://postgresapp.com/ instead of completely installing PostgreSQL Server on your Mac (which is also fine, but sometimes too much of a hassle).

Installing Postgres.app

Download it from https://postgresapp.com/ and make sure to follow the steps described in the site, of initiating the server and also running this Terminal:

sudo mkdir -p /etc/paths.d && echo /Applications/Postgres.app/Contents/Versions/latest/bin | sudo tee /etc/paths.d/postgresapp

This will help you to use psql and interact with the database using the command line interface (which if you ask me, is the way to go).

Once you have the server running and able to use the CLI tools, let’s create an user and a database:

Creating the user, database and grating privs:

  1. Connect to the postgres database:

    sudo -u postgres psql
  2. Create the user and set a password:

    create user myuser with encrypted password 'mypass';

    In here, you can replace myuser and mypass with what you want.

  3. Create your Jira DB (in this case the name if jiradb, buy you can change if you like:

  4. Lastly, you need to grant privileges:

Connecting to Jira

The official documentation is available and can be followed, but if you find it to be too long and not interesting, you can easily get the Jira config tool and connect.

  1. Navigate to your JIRA-INSTALL directory:

  2. Load the Jira config tool:

  3. Once loaded, in the Database tab, you choose PostgresQL and input the information for your local database:

  4. Once done, you can click test connection or if you are pretty sure, just click Save.

Congratulations!

With these simple and easy steps, you have Jira connected to a real database.

One tip, if you were previously using with the embedded database and would like to keep that data, just export an XML Backup before making this change. Then connect Jira to PostgreSQL and select Restore from backup in the first screen of the setup wizard.