How to change bamboo database mysql to mysql
Asked by tgix-msa:

In the process of upgrading bamboo from 6.2.5 to 6.4.1 we noticed that mysql 5.5.59 is no longer supported. To solve this we installed a new mysql 5.7.21 instance on a separate server and transferred the database using mysqldump.

We changed the hibernate.connection.url to point to the new database and started bamboo 6.4.1, bamboo didn't start. In catalina.out we then saw error messages:

```
Thu Mar 29 11:04:22 CEST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
```

Updated the jdbc url to include useSSL=false:

```
jdbc:mysql://<db-server-ip>:3306/bamboo?autoReconnect=true&amp;useUnicode=true&amp;useSSL=false&amp;characterEncoding=utf8&amp;sessionVariables=storage_engine=InnoDB
```

Tried again by still nothing happens and the following is now logged to catalina.out:

```
2018-03-29 11:36:23,857 WARN [C3P0PooledConnectionPoolManager[identityToken->z8kfsx9uvdf2kwoqwpwc|1b1d4db2]-HelperThread-#2] [Basi
cResourcePool] com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@d54bbbb -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30). Last acquisition attempt exception: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up.
```

We can connect using mysql cli on bamboo server and "-h database-ip"

What more do I need to change to get the bamboo instance to talk to a new database?

Should I change the database in 6.2.5 and then perform the upgrade?

Any help greatly appreciated!


Answers:
author: Christian Glockner
body: Hi,

Could it be that your MySQL server is enforcing SSL connections for the user you're using?

Cheers,

Christian

Premier Support Engineer

Atlassian

comments: author: tgix-msa
body: I can connect from bamboo host using "--skip-ssl" option to mysql command in the terminal, i.e. "$ mysql --skip-ssl -u bamboo -p -h bamboo-db"

Also using MySQL Workbench and "SSL = No" works.

Will try to dig further into this so I can upgrade to 6.4.


author: tgix-msa
body: Just to be 100% clear about the correct process to migrate to a new database host (without the update step).

1) shutdown bamboo 6.2.5

2) export db using "mysqldump -u root -p -B bamboo \> dump.sql"

3) transfer dump to new host and "cat dump.sql \| mysql"

4) set permissions of database. Tested connectivity from bamboo host with mysql from bash and --skip-ssl option. Connect works, I can access database and see all tables.

5) edit \<bamboo-home\>/bamboo.cfg.xml and change hibernate.connection.url to point to new database server instead of "localhost", i.e.

\<property name="hibernate.connection.url"\>jdbc:mysql://192.168.xx.yy/bamboo?autoReconnect=true\&amp;useUnicode=true\&amp;useSSL=false\&amp;characterEncoding=utf8\&amp;sessionVariables=storage_engine=InnoDB\</property\>

6) restart bamboo 6.2.5

When I restart bamboo 6.2.5 pointing to the new database I see tomcat start up but hangs with this message:

2018-04-02 08:02:58,793 INFO \[localhost-startStop-1\] \[C3P0Registry\] Initializing c3p0-0.9.5.2 \[built 08-December-2015 22:06:04 -0800; debug? true; trace: 10\]  
2018-04-02 08:02:58,904 INFO \[localhost-startStop-1\] \[AbstractPoolBackedDataSource\] Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@c6b88987 \[ connectionPoolDataSource -\> com.mchange.v2.c3p0.WrapperConnectionPoolDataSource@d4b74c67 \[ acquireIncrement -\> 1, acquireRetryAttempts -\> 30, acquireRetryDelay -\> 1000, autoCommitOnClose -\> false, automaticTestTable -\> null, breakAfterAcquireFailure -\> false, checkoutTimeout -\> 0, connectionCustomizerClassName -\> null, connectionTesterClassName -\> com.mchange.v2.c3p0.impl.DefaultConnectionTester, contextClassLoaderSource -\> caller, debugUnreturnedConnectionStackTraces -\> false, factoryClassLocation -\> null, forceIgnoreUnresolvedTransactions -\> false, forceSynchronousCheckins -\> false, identityToken -\> z8kfsx9u10w0jzsht7pw2\|135ae32c, idleConnectionTestPeriod -\> 100, initialPoolSize -\> 0, maxAdministrativeTaskTime -\> 0, maxConnectionAge -\> 0, maxIdleTime -\> 30, maxIdleTimeExcessConnections -\> 0, maxPoolSize -\> 100, maxStatements -\> 0, maxStatementsPerConnection -\> 0, minPoolSize -\> 0, nestedDataSource -\> com.mchange.v2.c3p0.DriverManagerDataSource@e6aaee56 \[ description -\> null, driverClass -\> null, factoryClassLocation -\> null, forceUseNamedDriverClass -\> false, identityToken -\> z8kfsx9u10w0jzsht7pw2\|4b5e85ad, jdbcUrl -\> jdbc:mysql://192.168.xx.yy/bamboo?autoReconnect=true\&useUnicode=true\&useSSL=false\&characterEncoding=utf8\&sessionVariables=storage_engine=InnoDB, properties -\> {user=\*\*\*\*\*\*, password=\*\*\*\*\*\*} \], preferredTestQuery -\> null, privilegeSpawnedThreads -\> false, propertyCycle -\> 0, statementCacheNumDeferredCloseThreads -\> 0, testConnectionOnCheckin -\> false, testConnectionOnCheckout -\> false, unreturnedConnectionTimeout -\> 0, usesTraditionalReflectiveProxies -\> false; userOverrides: {} \], dataSourceName -\> null, extensions -\> {}, factoryClassLocation -\> null, identityToken -\> z8kfsx9u10w0jzsht7pw2\|765c2442, numHelperThreads -\> 3 \]