Camunda DB initialization failed if db username is different from database name

If db’s username is different from database name, the initialization will fail. Some of the tables are created, but failed when reaching table act_ru_variable

Context:

  • Process Engine setup: Process Application with Spring Boot

  • Process Engine version: 7.12.0.

  • Camunda Spring Boot Starter version: 3.4.1, 3.4.2

  • Database & Version: MySQL 5.8, MariaDB 10.4.11, MariaDB 10.3.17

  • Database name & username: camunda/camunda-demo

    Caused by: org.camunda.bpm.engine.ProcessEngineException: ENGINE-03017 Could not perform operation ‘create’ on database schema for SQL Statement: ‘alter table ACT_RU_VARIABLE
    add constraint ACT_FK_VAR_CASE_EXE
    foreign key (CASE_EXECUTION_ID_)
    references ACT_RU_CASE_EXECUTION(ID_)’.
    Caused by: java.sql.SQLSyntaxErrorException: Table ‘camunda.act_ru_variable’ doesn’t exist

Database user permission:
image

anyone can help explain?

Never had the issue with h2 or postgres but mysql seems to create problems when no initial schema exists in the database.

After an empty schrema ex: “camunda_s” created and the spring-boot is restarted with the following data source config in application.yaml:

spring:
    datasource:
      url: 'jdbc:mysql://<db-instance-url>/camunda_s'
      username: 'db_user'
      password: 'db_password'
      autocommit: false

Then the spring-boot should start without errors and all the Camunda DB tables should be created as expected.

1 Like

you need to create empty schema which is prerequisite for running the camunda and the tables will be auto created when databaseSchemaUpdate =true property is enabled.

2 Likes

The schema does exists before running Camunda Spring Boot.
The tables will be auto created when username and database name are the same. But it failed when they are not.

Am I the only bad luck guy? :sweat_smile:

What’s your jdbc url connection? U can mask the host and provide

I got the same act_ru_variable doesn't exist problem with camunda 7.13 and mysql 5.6.40 using spring boot.
After I change db username to schema name, it create tables normally.

I am also on Camunda 7.13 and mysql 5.6 and strange thing is it worked for the first time even when the DB name and the username as different but fails if i change the DB to something else. I am facing issues while deploying the solution to Prod as its a new DB and i have been working with Dev DB all the while. The Prod DB and Dev DB is exact replica but unluckily i had to have a db with a different name than what it was in Dev.

Update: Finally i gave up and it seems that in Camunda 7.13 and MySql 5.6 you need to have the db name to be camunda in order to auto create the tables irrespective of the username. In case the DB name is not camunda you will have to manually create the tables.