MySQL is the relational database used by the Inventory service. In Quarkus, choosing it does not determine whether Panache uses active record or repository APIs: the database choice and application API are separate. The Inventory service pairs MySQL with the repository pattern. section 7.2
To connect the service and persist its entities:
- Add the Panache ORM and MySQL JDBC extensions, then configure the datasource in application.properties. section 7.2.1
- Define a standard JPA entity with an ID, then create an application-scoped class implementing PanacheRepository for that entity. Repository methods can add queries such as a lookup by license plate number. section 7.2.1
Listing 7.12 Properties required for MySQL connection
quarkus.datasource.db-kind=mysql #1 quarkus.datasource.username=user quarkus.datasource.password=pass %prod.quarkus.datasource.jdbc.url=jdbc:mysql://localhost:3306/inventory # drop and create the database at startup quarkus.hibernate-orm.database.generation=drop-and-create
The connection properties identify MySQL, supply credentials, and set a production JDBC URL. The shown drop-and-create setting recreates the database schema at startup; it is not a data-preserving setting. section 7.2.1
Deployment changes where the service reaches MySQL. A production URL pointing at localhost is replaced, for the Kubernetes deployment, with a URL using the mysql service name. Applying the manifest creates resources for both the database and Inventory service; the example then checks the pods and forwards the application port. section 11.3.3
Listing 11.12 Changing the location of the MySQL database in Kubernetes
quarkus.kubernetes.env.vars.quarkus-datasource-jdbc-url= jdbc:mysql://mysql:3306/inventory
This setting supplies the JDBC URL used to reach MySQL from the Kubernetes deployment. section 11.3.3

