Legacy Knowledge Base
Published Sep. 10, 2025

This version of MySQL doesn't yet support 'existing primary key drop without adding a new primary key

Written By

Sorin Pop

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack" publication program, made available for informational purposes. Articles in this program were published without a requirement for independent editing or verification and are provided"as is" without guarantee.

Before using any information from this article, independently verify its suitability for your situation and project.

Issue

  • We are upgrading from liferay-dxp-tomcat-2023.q4.4 to liferay-dxp-tomcat-2025.q1.15-lts. Currently we are using Mysql 8.0.41-azure on our server which is compatible with liferay-dxp-tomcat-2025.q1.15-lts.
  •  
  • Liferay Version: 2025.Q1.15
  • Database: MySQL 8.0.41-Azure
  • Upgrade Tool: portal-tools-db-upgrade-client
  •  
  • We are getting below error while running DB upgrade tool on test environment. Please find below the error logs:
  •  
  • 2025-08-13 10:20:28.493 INFO  [main][UpgradeProcess:119] Upgrading com.liferay.portal.kernel.upgrade.CTModelUpgradeProcess
  • 2025-08-13 10:20:28.494 INFO  [main][LoggingTimer:74] Starting com.liferay.portal.kernel.upgrade.CTModelUpgradeProcess#doUpgrade#AnnouncementsDelivery
  • 2025-08-13 10:20:28.605 INFO  [main][LoggingTimer:35] Completed com.liferay.portal.kernel.upgrade.CTModelUpgradeProcess#doUpgrade#AnnouncementsDelivery in 111 ms
  • 2025-08-13 10:20:28.605 INFO  [main][UpgradeProcess:137] Failed upgrade process com.liferay.portal.kernel.upgrade.CTModelUpgradeProcess in 112 ms
  • 2025-08-13 10:20:28.606 INFO  [main][PortalUpgradeProcess:336] Failed upgrade process com.liferay.portal.upgrade.PortalUpgradeProcess in 534 ms
  • 2025-08-13 10:20:28.626 ERROR [main][DBUpgrader:70] com.liferay.portal.kernel.upgrade.UpgradeException: java.sql.SQLSyntaxErrorException: This version of MySQL doesn't yet support 'existing primary key drop without adding a new primary key. In @@sql_generate_invisible_primary_key=ON mode table should have a primary key. Please add a new primary key to be able to drop existing primary key.'
  • com.liferay.portal.kernel.upgrade.UpgradeException: com.liferay.portal.kernel.upgrade.UpgradeException: java.sql.SQLSyntaxErrorException: This version of MySQL doesn't yet support 'existing primary key drop without adding a new primary key. In @@sql_generate_invisible_primary_key=ON mode table should have a primary key. Please add a new primary key to be able to drop existing primary key.'
  • at com.liferay.portal.upgrade.PortalUpgradeProcess.upgrade(PortalUpgradeProcess.java:330) ~[portal-impl.jar:?]
  • at com.liferay.portal.kernel.upgrade.util.UpgradeProcessUtil._upgradeProcess(UpgradeProcessUtil.java:172) ~[portal-kernel.jar:?]
  • at com.liferay.portal.kernel.upgrade.util.UpgradeProcessUtil.upgradeProcess(UpgradeProcessUtil.java:148) ~[portal-kernel.jar:?]
  • at com.liferay.portal.events.StartupHelperUtil.upgradeProcess(StartupHelperUtil.java:176) ~[portal-impl.jar:?]
  • at com.liferay.portal.tools.DBUpgrader.upgradePortal(DBUpgrader.java:300) ~[portal-impl.jar:?]
  • at com.liferay.portal.tools.DBUpgrader.main(DBUpgrader.java:171) [portal-impl.jar:?]
  • at jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ~[?:?]
  • at java.lang.reflect.Method.invoke(Method.java:580) ~[?:?]
  • at com.liferay.portal.tools.db.upgrade.client.DBUpgraderLauncher.main(DBUpgraderLauncher.java:45) [com.liferay.portal.tools.db.upgrade.client.jar:?]
  • Caused by: com.liferay.portal.kernel.upgrade.UpgradeException: java.sql.SQLSyntaxErrorException: This version of MySQL doesn't yet support 'existing primary key drop without adding a new primary key. In @@sql_generate_invisible_primary_key=ON mode table should have a primary key. Please add a new primary key to be able to drop existing primary key.'
  • at com.liferay.portal.kernel.upgrade.UpgradeProcess.upgrade(UpgradeProcess.java:128) ~[portal-kernel.jar:?]
  • at com.liferay.portal.kernel.upgrade.UpgradeProcess.upgrade(UpgradeProcess.java:146) ~[portal-kernel.jar:?]
  • at com.liferay.portal.upgrade.PortalUpgradeProcess.doUpgrade(PortalUpgradeProcess.java:355) ~[portal-impl.jar:?]
  • at com.liferay.portal.upgrade.PortalUpgradeProcess.upgrade(PortalUpgradeProcess.java:325) ~[portal-impl.jar:?]
  • ... 8 more
  • Caused by: java.sql.SQLSyntaxErrorException: This version of MySQL doesn't yet support 'existing primary key drop without adding a new primary key. In @@sql_generate_invisible_primary_key=ON mode table should have a primary key. Please add a new primary key to be able to drop existing primary key.'
  • at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:121) ~[mysql.jar:8.3.0]

Environment

  • QR

Resolution

  • We believe the solution might be to disable `sql_generate_invisible_primary_key` parameter in Azure MySQL.
     
    The error message `java.sql.SQLSyntaxErrorException: This version of MySQL doesn't yet support 'existing primary key drop without adding a new primary key. In @@sql_generate_invisible_primary_key=ON mode table should have a primary key...'` explicitly indicates that the failure is due to the `sql_generate_invisible_primary_key` setting being enabled on the MySQL server.
     
    This MySQL 8.0 feature, when active, prevents the Liferay upgrade process from executing necessary steps that involve dropping a primary key from a table. The solution is to disable this feature for the duration of the upgrade.
     
    For Azure Database for MySQL, this can be done via the Azure Portal:
    1. Navigate to the specific Azure Database for MySQL server instance.
    2. In the sidebar menu, under Settings, select Server parameters.
    3. Search for the `sql_generate_invisible_primary_key` parameter.
    4. Change its value from `ON` to `OFF`.
    5. Save the changes.
     
    After the parameter change has been applied, the database upgrade process should be executed again. The parameter can be re-enabled after the upgrade is complete if required.

 

 

 

Did this article resolve your issue ?

Legacy Knowledge Base