Connection refused error when connecting to MySQL database in Jira server

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform Notice: Server and Data Center Only - This article only applies to Atlassian products on the server and data center platforms.

Problem

User unable to connect to MySQL while trying to configure JIRA for the first time. After creating the database and going through the setup process, user is prompted *Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.* error.


Environment

JIRA 7.0.4

Ubuntu 14.04 Server

MySQL 5.6.27

JDBC Driver : mysql-connector-java-5.1.38-bin.jar

Diagnosis


Diagnostic Steps

  • Ensure the database created is detected. Use show databases; query in MySQL to see all the database.

  • Run netstat -tln command in terminal to see whether MySQL is listening to port 3306 in localhost
  • Login to MySQL in terminal and run SHOW GRANTS FOR 'jira'@'localhost'; to check whether the JIRA user is permitted to access the database from localhost.

Cause

Previously if the MySQL is setup to have remote access, it might be configured to access the LAN IP rather than localhost (127.0.0.1:3306) IP. If any user setup MySQL in localhost, JIRA will be unable to connect to MySQL because MySQL is not connected to localhost.

Resolution

If MySQL is listening to LAN IP, change it back so it listen to the localhost.

  • Open /etc/mysql/my.cnf in a text editor
  • Change the bind-address = 192.X.X.X to bind-address = 127.0.0.1 and save
  • Restart MySQL service

  • Use netstat -tln to verify that MySQL is listening in localhost 127.0.0.1:3306 port.

DescriptionUser unable to connect to MySQL while trying to configure JIRA for the first time. After creating the database and going through the setup process, user is prompted *Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.* error.
ProductJira
PlatformServer
Last modified on Sep 25, 2019

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.