Database Connection Following Upgrade to 8.20.1

NickSmithTech November 2, 2021

So I attempted an updated of JIRA from 8.18.0 to 8.20.1 in response to CVE-2021-42574

It ended with me not being able to connect to the database and having to revert to the volume snapshot I made.

Has anyone had any luck with the this type of upgrade? I can't imagine it's too rare to be using MySQL.


Methodology

  • Performed Snapshots/Backups (experience has proven this is necessary because JIRA seems intentionally difficult to adminster)
  • Wget, chmod and execute script.
  • Seems to run okay with no errors
  • Apply changes manually (since this is still a thing duh) to conf/server.xml
  • Start JIRA

Get:

Database: We've found an error in MySQL supported version!
The database type in your dbconfig.xml is set up to MySQL 5.7 and your MySQL version is different. Consider using MySQL 5.7 database type instead
See our documentation for more information on changing database type.

Applied these changes to dbconfig.xml:

  • Add "&sessionVariables=default_storage_engine=InnoDB" to url connection string
  • Change <database-type>mysql57</database-type> to <database-type>mysql</database-type>

That error goes away.

Also getting:

Database: JIRA couldn't connect to your database
JIRA failed to establish a connection to your database.
This could be because:
-Your database isn't running
-The configuration of your dbconfig.xml file is incorrect (user, password, or database URL etc.)
-There is a network issue between JIRA and your database (e.g. firewall, database doesn't allow remote access etc.)

There are several other solutions you can try, review our documentation and see what works for you."

Get this garbage in the log:

The last packet successfully received from the server was 26 milliseconds ago. The last packet sent successfully to the server was 22 milliseconds ago.
2021-11-02 11:16:34,110-0400 JIRA-Bootstrap ERROR [c.a.jira.health.HealthChecks] JIRA failed to establish a connection to your database.

Attempted fixes:

  • Upgrade Java from 1.7 to 1.8
  • Update JDBC driver to 5.49

Still getting the connection error.

We run Confluence on the same instance and it had no db connection issues.

Server is MySQL 5.7.33 running on Amazon RDS. We run JIRA on Amazon Linux AMI.

Unable to resolve.

Exceeded maintenance window by an hour and had to revert and continue to run unsafe software.

Whole morning wasted. Thanks Atlassian!

8 answers

1 vote
John Allison November 15, 2021

I resolved the error by adding the parameter "useSSL=false&" in the dbconfig.xml file and restarting the JIRA.

webdeveloper November 15, 2021

This did not work for me

Martin Hilbig [team neusta] November 18, 2021

we had this parameter already since update to 8.13.x -

update to 8.20.x still failed on Prod, while it was succesful in Staging. 

 

we have no indication what could be the reason

0 votes
Graham White April 7, 2022

Adding a link to my solution documented in another discussion in case it helps anyone. For me it was both mysql-java-connector upgrade to Connector/J 8.0.28 and changes to dbconfig.xml that got me up and running again on LTS 8.20.7

 https://community.atlassian.com/t5/Jira-discussions/JIRA-8-13-6-LTS-to-8-20-7-LTS-on-Windows-with-MySQL-5-7-Upgrade/m-p/1996486#M16655 

0 votes
kai_schuerrer November 21, 2021

My working solution was a combination with the hint from John Allison (see above) and fixing an error I found in the startup logfile of my server:

 

Error I found in my installation was:

19-Nov-2021 18:21:59.983 SCHWERWIEGEND [Catalina-startStop-1] org.apache.catalina.startup.HostConfig.beforeStart Unable to create directory for deployment: [/opt/atlassian/jira/conf/Catalina/localhost]
2

 

So my solution for fixing this issue is:

1) Create 2 Directorys:

a) Below /opt/atlassian/jira/conf/ creat a directory named Catalina

b) After that creat a directory inside the directory you created in step a) /opt/atlassian/jira/conf/Catalina/ create localhost

c) check for the right group and ownsership and modes for the dirs you just created

 

2) Apply solution from John Allison:

a) Find location of your dbconfig.xml file by entering find / -name dbconfig.xml

b) cd to that location

c) Edit this file by nano ./dbconfig.xml  (in my case: nano /var/atlassian/application-data/jira/dbconfig.xml )

d) adding the parameter "useSSL=false&" to the connection string - but beware, you have to use the notation like the other parameters, so in real you have to add useSSL=false&amp; after one ; in the connection string.

e) save your work

 

After that restart your server. Now it should work.

I verified it on 4 different installations and it worked for me in any case. Doing only one ofe the steps will not work (I tried a lot).

 

Hope this will help

 

Best regards,

Kai

John Meola November 22, 2021

Thanks, Kai! Your solution worked for me.

0 votes
JWCho November 18, 2021

I'm also having same issue. We are using MySQL 5.7.29 on Jira 8.11.

I tried upgrading Jira to 8.20 and it's throwing database cannot be connected.

I'm looking at this doc: https://confluence.atlassian.com/kb/how-to-fix-the-collation-and-character-set-of-a-mysql-database-manually-744326173.html

and our Jira database is in utf8 collation.

I'm wondering if this can be reason because from that doc, after Jira 8.12, database collation must be utf8mb4. So, maybe I may need to change Jira DB to utf8mb4 collation.

John Meola November 18, 2021

This is what we are using successfully for 8.13.5:

mysql> SELECT @@character_set_database, @@collation_database;
+--------------------------+----------------------+
| @@character_set_database | @@collation_database |
+--------------------------+----------------------+
| utf8mb4 | utf8mb4_general_ci |
+--------------------------+----------------------+
1 row in set (0.00 sec)

mysql> SELECT DEFAULT_CHARACTER_SET_NAME, DEFAULT_COLLATION_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = 'jira';
+----------------------------+------------------------+
| DEFAULT_CHARACTER_SET_NAME | DEFAULT_COLLATION_NAME |
+----------------------------+------------------------+
| utf8mb4 | utf8mb4_bin |
+----------------------------+------------------------+
1 row in set (0.00 sec)

But this is not working when we attempted to upgrade to version 8.20.

JWCho April 8, 2022

I have followed this and it resolved our mysql DB converting all table's collation to UTF8MB4.

https://www.claudiokuenzler.com/blog/1009/convert-jira-database-tables-utf8-utf8mb4-solve-collation-errors

and I was able to upgrade our Jira 8.12 or higher.

Our Jira is now on 8.20.2.

The link that Atlassian has provided: https://confluence.atlassian.com/kb/how-to-fix-the-collation-and-character-set-of-a-mysql-database-744326173.html

Did not convert mysql DB collation fully.

So if anyone has issue with mysql db connection on Jira after 8.12, look at the blog that I have provided.

0 votes
webdeveloper November 14, 2021

Having the same issue as yourself.  Upgrading MySQL from v5.6 to v.5.7, and Jira from v8.2.4 to long term support v.8.20.  Running RHEL 7.9 and Java 8 on MS Azure.  I have the luxury of doing this in a test environment before applying to production.

Upgrading MySQL to v.5.7 worked fine.  Skim tested Jira v.8.2.4 and it seemed to work ok.  After upgrading JIRA to v.8.20, that is when I get the same error as yourself.  Nothing special logged in any log files.

 

https://confluence.atlassian.com/kb/how-to-fix-the-collation-and-character-set-of-a-mysql-database-744326173.html

Makes note of the fact that for Jira 8.12 or later, you must use utf8mb4.  I followed the steps on that web page, did not resolve my issue.

0 votes
mbingaman November 9, 2021

Check your mysql log. We were seeing 'bad handshake' messages on Jira startup. As it turns out, the JDBC does not enable TLS1.2 by default so the connection was failing. Nothing was showing up in the Jira logs except that the database couldn't be connected to. The message about the mysql version was a red herring and just wrong. Was able to work around this by adding the following to the JDBC connection string in dbconfig.xml:

'enabledTLSProtocols=TLSv1.2'

Why this became an issue only now with more recent versions I have to guess it's a regression and Atlassian doesn't actually test their software releases with all the things they claim it works with.

webdeveloper November 14, 2021

Even though I don't get this error logged in the MySQL logs, I tried this in my test environment and it did not resolve the issue for me. 

Matt Zuba February 25, 2022

Thanks @mbingaman - unlike other solutions of just disabling the SSL check which I didn't want to do, this fixed the issue for me.

0 votes
John Allison November 8, 2021

Same problem here, upgrading from 8.15.0 to 8.20.1. Produces "Database: JIRA couldn't connect to your database"

checked logs (nothing useful)

double checked content of server.xml and setenv.sh, found nothing suspect

Confirmed mysql DB is running, and we can connect from the server.

upgrades fine, but Jira wont connect to the DB 

0 votes
Atticus Bikos November 3, 2021

We experienced the same issue but on a different version. We were attempting an upgrade from 8.13.4 to 8.13.13. Please let us know if you hear from Atlassian about this topic.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
8.20.1
TAGS
AUG Leaders

Atlassian Community Events