From f9146d80fdbf9c9130ae4e07d2d9956c7014b455 Mon Sep 17 00:00:00 2001 From: Sameer Kumar Subudhi Date: Tue, 9 Apr 2024 17:28:52 +0200 Subject: [PATCH] :hammer: Ensure 'lisk' DB is always present on the MySQL read replica(s) --- docker-compose.yml | 1 + docker/mysql/read/init/01-databases.sql | 3 +++ 2 files changed, 4 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 89f55a779a..86cc0d77e4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -75,6 +75,7 @@ services: endpoint_mode: vip environment: - MYSQL_ROOT_PASSWORD=password + - MYSQL_DATABASE=lisk healthcheck: test: ['CMD', 'mysqladmin', 'ping', '-hlocalhost', '-ppassword'] diff --git a/docker/mysql/read/init/01-databases.sql b/docker/mysql/read/init/01-databases.sql index b82b1200cb..0dc1ead13c 100644 --- a/docker/mysql/read/init/01-databases.sql +++ b/docker/mysql/read/init/01-databases.sql @@ -1,3 +1,6 @@ +-- Create database(s). +CREATE DATABASE IF NOT EXISTS `lisk`; + -- Create `reader` user for read queries and grant read privilages. CREATE USER 'reader'@'%' IDENTIFIED WITH caching_sha2_password BY 'password'; GRANT SELECT ON *.* TO 'reader'@'%';