Bitbucket Server as a service and the database as currently configured is not accessible error
If Bitbucket Server is configured as a service on Windows, the following appears on the UI when it is started by the service:
A fatal error has occurred The following problem occurred which prevents Atlassian Bitbucket Server from starting correctly: The database, as currently configured, is not accessible. Bitbucket Server is configured to use the mysql driver (com.mysql.jdbc.Driver) but it is not available. Please follow the instructions to install the driver as per Connecting Bitbucket Server to MySQL.
However, when starting Bitbucket Server manually from its binary works just fine.
You followed our Connecting Bitbucket Server to MySQL document properly in regards to the step below:
Connecting Bitbucket Server to MySQL
3. Copy the mysql-connector-java-5.1.XX-bin.jar file from the extracted directory to your
<Bitbucket home directory>/lib (for Bitbucket Server 2.1 or later).
<Bitbucket home directory>/lib support is a nicety added by our setenv scripts, which aren't called when running as a service. The service stuff is all baked into the
tomcat?.exe binary. That's why the driver when placed under
<Bitbucket home directory>/lib only works when manually starting Bitbucket Server.
As a workaround, place the MySQL jar connector (
<BITBUCKET_INSTALLATION_DIR>/atlassian-bitbucket/WEB_INF/lib instead if you are starting Bitbucket Server as a service.
This is not given as a primary guideline on Connecting Bitbucket Server to MySQL because the driver would be lost when upgrading Bitbucket Server. Hence, if you upgrade Bitbucket Server at this stage you will need to perform this again.