7.19.0 upgraded. 8.4.0 Prompt that the database cannot be connected
Asked by Bournevill:

I upgraded Confluence from 7.19.0 to 8.4.0, following <https://confluence.atlassian.com/kb/how-to-fix-the-collation-and-character-set-of-a-mysql-database-> manually-744326173.html I modified mysql, but the server cannot be started, what should I do?  
? \[13\] ??? \[errors.jsp\] ????? 10: \<link rel="shortcut icon" href="johnson/fav-confluence.ico"\> 11: \<% 12: JohnsonPageI18NProvider johnsonPageI18NProvider = (JohnsonPageI18NProvider ) BootstrapUtils.getBootstrapContext().getBean("johnsonPageI18NProvider"); 13: String translations = johnsonPageI18NProvider.getTranslations().serialize(); 14: %\> 15: \<script\> 16: window.i18n = \<%=translations%\> ; Stacktrace:

Error creating bean with name 'tenantedTransactionManager' defined in class path resource \[productionDatabaseContext.xml\]: Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tenantedLocalSessionFactoryPro totype5' defined in class path resource \[productionDatabaseContext.xml\]: Invocation of init method failed; nested exception is org.hibernate.service.spi.ServiceException: Unable to create requested service \[org.hibernate.engine.jdbc.env.spi.JdbcEnvironment\]

Error creating bean with name 'tenantedLocalSessionFactoryPrototype5' defined in class path resource \[productionDatabaseContext.xml\]: Invocation of init method failed; nested exception is org.hibernate.service.spi.ServiceException: Unable to create requested service \[org.hibernate.engine. jdbc.env.spi.JdbcEnvironment\]

Unable to create requested service \[org.hibernate.engine.jdbc.env.spi.JdbcEnvironment\]

com.zaxxer.hikari.pool.HikariPool$PoolInitializationException: Failed to initialize pool: Access denied for user 'root'@'localhost' (using password: YES)

Failed to initialize pool: Access denied for user 'root'@'localhost' (using password: YES)

Access denied for user 'root'@'localhost' (using password: YES)


Answers:
author: Bournevill
body: I found that after the upgrade, the password of the confluence.cfg.xml was changed, and the "\&amp;" was automatically added. After the modification, this error will not be reported, but a new error has appeared. Detected tables with non-default character encoding. See <https://confluence.atlassian.com/x/TABrFw>, I have modified the encoding method of the database according to <https://confluence.atlassian.com/kb/how-to-fix-the-collation-and-character-set-of-a-mysql-database-manually-744326173.html> , what else do I need to do?


author: Nic Brough -Adaptavist-
body: Welcome to the Atlassian Community!

There are a couple of problems entwined here.

First, the obvious one is that your database is not configured to allow the account "root" to use the Confluence database.

But, that's probably not the cause of the problem. The main problem is that you should never be running Confluence with the root user (and hence root never needs access to the database)

I suspect you have used the wrong startup method, one that does not run the process as a user who is supposed to be running it, and has been set up to be able to use your database.

When you run an Atlassian system with the root account, it takes ownership of many of the files that Confluence needs full read/write access to as well, so it's likely that your attempt to start Confluence with the wrong user has also broken the file system as well as the database access.

What you need to do next:

* Work out what user should be being used to run Confluence
* Chown -R user:group \<Confluence install\>
* Chown -R user:group \<Confluence data/home\>
* Start Confluence as that user

If you look at the permissions in the database, you should find the user named, but you can also look at the file system - many of the files in the install and data directories will not have had their ownership changed to root, so they files are probably better off looking at this 0 "ls -l" will give you user and group that should be running confluence, not just the user name.

comments: author: Nic Brough -Adaptavist-
body: Oh, and cat /etc/passwd will probably tell you the right user too - this laptop has users called "jira" and "conf" named in there, alongside "root", "nic" and "esk" (my old d?mon cat who I used to test less privileged stuff)


author: Bournevill
body: I found that after the upgrade, the password of the confluence.cfg.xml was changed, and the \&amp; was automatically added. After the modification, this error will not be reported, but a new error has appeared. Detected tables with non-default character encoding. See <https://confluence.atlassian.com/x/TABrFw>, I have modified the encoding method of the database according to <https://confluence.atlassian.com/kb/how-to-fix-the-collation-and-character-set-of-a-mysql-database-manually-744326173.html> , what else do I need to do?


author: Nic Brough -Adaptavist-
body: You will need to edit the confluence.cfg.xml to correct the password back to what it should be (the installer does not change passwords when upgrading, that's something one of your admins will have had to do), and then apply the right encoding as per the docs you have been reading.


Tags: confluence-server

server