FFFF
Skip to content

Repository files navigation

MySQL rock

Release to GHCR

This repository contains the packaging metadata for creating a rock of MySQL built from the official ubuntu MySQL package from the Ubuntu repository and further installs mysql-shell. For more information on rocks, visit the rockcraft repository.

Building the rock

The steps outlined below are based on the assumption that you are building the rock with the latest LTS of Ubuntu. If you are using another version of Ubuntu or another operating system, the process may be different.

Clone Repository

git clone https://github.com/canonical/mysql-rock.git
cd mysql-rock

Installing Prerequisites

sudo snap install rockcraft --classic --edge
sudo snap install docker
sudo snap install lxd

Configuring Prerequisites

sudo usermod -aG docker $USER 
sudo lxd init --auto

Packing and Running the rock

rockcraft pack
rockcraft.skopeo --insecure-policy copy oci-archive:mysql*.rock docker-daemon:<username>/mysql:<tag>
docker run --rm -it --name mysql-container -p 30306:3306 -e MYSQL_ROOT_PASSWORD=myS3cr3tp@ss <username>/mysql:<tag>

Connecting to MySQL

From inside the container (using socket):

docker exec -it mysql-container mysql --socket=/var/run/mysqld/mysqld.sock --user=root --password=myS3cr3tp@ss

From outside the container:

sudo apt install -y mysql-client
mysql -h 127.0.0.1 --password=myS3cr3tp@ss --port=30306 --user=root

Troubleshooting:

docker exec -it mysql-container pebble logs
docker exec -it mysql-container pebble services
docker exec -it mysql-container pebble restart postgres

Testing rock

Using Spread:

rockcraft test                       # run all tests
ls -la spread/tests/                 # list all tests
rockcraft test -- spread/tests/smoke # run one test suite
rockcraft test --debug               # to open shell for failed test
rockcraft test --shell-after         # to open shell after each step

License

The MySQL rock is free software, distributed under the Apache Software License, version 2.0. See LICENSE.

Releases

Packages

Used by

Contributors

Languages

0