MySQL

  • By Canonical Data Platform
  • Cloud
Channel Revision Published Runs on
latest/edge 135 Yesterday
Ubuntu 22.04
juju deploy mysql --channel edge
Show information

Platform:

Ubuntu
22.04

Charmed MySQL VM operator

Description

This repository contains a Juju Charm for deploying MySQL on virtual machines (LXD). To deploy on Kubernetes, please use Charmed MySQL K8s operator.

Usage

To deploy this charm using Juju 2.9 or later, run:

juju add-model my-model
juju deploy mysql --channel edge

Note: the above model must be created on LXD (virtual machines) environment. Use another charm for K8s!

To confirm the deployment, you can run:

juju status --watch 1s

Once MySQL starts up, it will be running on the default port (3306). Please follow the tutorial guide with detailed explanation how to access DB, configure cluster, change credentials and/or enable TLS.

If required, you can remove the deployment completely by running:

juju destroy-model my-model --destroy-storage --yes

Note: the --destroy-storage will delete any data persisted by MySQL.

Relations

Modern relations

This charm implements the provides data platform library, with the modern mysql_client interface. To relate to it, use the requires data-platform library.

Adding a relation is accomplished with:

# Deploy MySQL cluster with 3 nodes
juju deploy mysql -n 3 --channel edge
# Deploy the relevant charms
juju deploy mycharm
# Relate mysql with mycharm
juju relate mysql mycharm

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

Legacy relations

Note: Legacy relations are deprecated and will be discontinued on future releases. Usage should be avoided.

This charm supports several legacy interfaces, e.g. db-router, shared-db and mysql:

  1. db-router is a relation that one uses with the mysql router charm. The following commands can be executed to deploy and relate to the keystone charm:
juju deploy mysql --channel edge
juju deploy mysql-router --series focal
juju deploy keystone --series focal
juju relate mysql-router keystone
juju relate 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).

  1. shared-db 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 relate to the keystone charm:

juju deploy mysql --channel edge
juju deploy keystone --series focal
juju relate keystone:shared-db mysql:shared-db
  1. mysql is a relation that's used from some k8s charms and can be used in cross-model relations.
juju deploy mysql --channel edge
juju deploy mediawiki
juju relate mysql:mysql mediawiki:db

Contributing

Please see the Juju SDK docs for guidelines on enhancements to this charm following best practice guidelines, and CONTRIBUTING.md for developer guidance.

License

The Charmed MySQL VM Operator is distributed under the Apache Software License, version 2.0. It installs/operates/depends on MySQL Community Edition, which is licensed under the GPL License, version 2.

Trademark Notice

MySQL is a trademark or registered trademark of Oracle America, Inc. Other trademarks are property of their respective owners.