Charmed MySQL

  • By Canonical Data Platform
  • Cloud
Channel Revision Published Runs on
8.0/stable 196 29 Sep 2023
Ubuntu 22.04
8.0/candidate 203 14 Dec 2023
Ubuntu 22.04
8.0/beta 216 18 Mar 2024
Ubuntu 22.04
8.0/edge 222 16 Apr 2024
Ubuntu 22.04
juju deploy mysql --channel 8.0/stable
Show information

Platform:

Ubuntu
22.04

Interfaces/endpoints

:information_source: Hint: Use Juju 3. Otherwise replace juju integrate with juju relate for Juju 2.9.

Charmed MySQL VM supports modern mysql_client and legacy mysql, mysql-shared, mysql-router interfaces (in a backward compatible mode).

Note: do NOT integrate (relate) both modern and legacy interfaces simultaneously.

Modern relations

This charm provides modern ‘mysql_client’ interface. Applications can easily connect MySQL using ‘data_interfaces’ library from ‘data-platform-libs’.

Modern mysql_client interface (database endpoint):

Adding a relation is accomplished with juju integrate via endpoint database. Read more about Juju relations (integrations). Example:

# Deploy Charmed MySQL cluster with 3 nodes
juju deploy mysql -n 3 --channel 8.0

# Deploy the relevant charms, e.g. mysql-test-app
juju deploy mysql-test-app

# Integrate (relate) MySQL with your application
juju integrate mysql:database mysql-test-app:database

# Check established relation (using mysql_client interface):
juju status --relations

# Example of the properly established relation:
# > Relation provider   Requirer                 Interface     Type
# > mysql:database      mysql-test-app:database  mysql_client  regular

Find all details about default and extra DB user roles in “Charm Users explanations”.

Note: In order to integrate with this charm, every table created by the integrated application must have a primary key. This is required by the group replication plugin enabled in this charm.

Legacy relations

Note: Legacy relations are deprecated and will be discontinued on future releases. Usage should be avoided. Check the legacy interface implementation limitations in the “Legacy charm” document.

This charm supports several legacy interfaces, e.g. mysql, mysql-shared, mysql-router. They were used in some legacy charms in cross-model relations.

mysql interface (mysql endpoint)

It was a popular interface used by some legacy charms (e.g. “MariaDB”, “OSM MariaDB”, “Percona Cluster” and “Mysql Innodb Cluster”), often in cross-model relations:

juju deploy mysql --channel 8.0
juju config mysql mysql-interface-database=mediawiki mysql-interface-user=mediawiki
juju deploy mediawiki
juju integrate mysql:mysql mediawiki:db

mysql-router interface (db-router endpoint)

It is a relation that one uses with the mysql router charm. The following commands can be executed to deploy and integrate to the keystone charm:

juju deploy mysql --channel 8.0
juju deploy mysql-router --series focal
juju deploy keystone --series focal
juju integrate mysql-router keystone
juju integrate mysql:db-router mysql-router:db-router

Note: pay attention to deploy identical series for keystone and mysql-router applications (due to the subordinate charm nature of mysql-router).

mysql-shared interface (shared-db endpoint)

It is a relation that one uses when the application needs to connect directly to the database cluster. It is supported by various legacy charms, e.g. mysql-innodb-cluster. The following commands can be executed to deploy and integrate to the keystone charm:

juju deploy mysql --channel 8.0
juju deploy keystone --series focal
juju integrate keystone:shared-db mysql:shared-db

Help improve this document in the forum (guidelines). Last updated 4 months ago.