Articles in this section

How to add Multiple MariaDB/MySQL databases

You can define multiple MySQL databases within one service. To do so, define multiple schemas in your service configuration. Note that this is possible only on version10.0 or later.

You can also specify multiple endpoints for permissions. If neither schemas nor endpoints is included, it’s equivalent to the following default:

.platform/services.yaml
    configuration:
        schemas:
            - main
        endpoints:
            mysql:
                default_schema: main
                privileges:
                    main: admin

If any of schemas or endpoints are defined, no default option is applied and you have to specify the full configuration.

 

The following configuration example creates a single MariaDB service named db with two databases, main and legacy. Access to the database is defined through three endpoints:

  • admin has full access to both databases.
  • reporter has SELECT query access to main but no access to legacy.
  • importer has SELECT/INSERT/UPDATE/DELETE (but not DDL) access to legacy but no access to main.
.platform/services.yaml
db:
    type: mariadb:10.5
    disk: 2048
    configuration:
        schemas:
            - main
            - legacy
        endpoints:
            admin:
                default_schema: main
                privileges:
                    main: admin
                    legacy: admin
            reporter:
                privileges:
                    main: ro
            importer:
                default_schema: legacy
                privileges:
                    legacy: rw

For further details please check the documentation on Multiple databases.

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.