MySQLSyntaxErrorException for OPTION SQL_SELECT_LIMIT=500 when using MySQL
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Problem
MySQL database configuration setup fails and the following appears in the atlassian-bitbucket.log
The schema could not be created.
com.atlassian.stash.internal.db.DefaultDatabaseManager.createSchema(DefaultDatabaseManager.java:341)
com.atlassian.stash.internal.db.DefaultDatabaseManager.prepareDatabase(DefaultDatabaseManager.java:191)
com.atlassian.stash.internal.maintenance.SpringMaintenanceTaskFactory.setupTask(SpringMaintenanceTaskFactory.java:151)
...
Error creating bean with name 'liquibasePrototype' defined in class path resource [stash-context.xml]: Invocation of init method failed; nested exception is liquibase.exception.MigrationFailedException: Migration failed for change set liquibase/r3_2/upgrade.xml::STASHDEV-6754-2::jhinch:
Reason: liquibase.exception.UnexpectedLiquibaseException: liquibase.exception.CustomChangeException: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'OPTION SQL_SELECT_LIMIT=500' at line 1
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1628)
...
Migration failed for change set liquibase/r3_2/upgrade.xml::STASHDEV-6754-2::jhinch:
Reason: liquibase.exception.UnexpectedLiquibaseException: liquibase.exception.CustomChangeException: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'OPTION SQL_SELECT_LIMIT=500' at line 1
liquibase.changelog.ChangeSet.execute(ChangeSet.java:619)
...
...
error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'OPTION SQL_SELECT_LIMIT=500' at line 1
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
Cause
- MySQL driver installed is relatively old.
Resolution
- Stop Bitbucket Server.
- Move the old
mysql-connector-java-5.1.XX-bin.jar
driver from<Bitbucket home directory>/lib
to a backup location.- Ensure that only 1 version of the driver file exists in the lib directory.
- Download the latest driver from http://dev.mysql.com/downloads/connector/j/ to
<Bitbucket home directory>/lib
. - Start Bitbucket Server.
Last modified on Oct 9, 2017
Powered by Confluence and Scroll Viewport.