dockersetup: Switch from mysql to mariadb binaries

In the last versions of mariadb:lts docker container, the database
management binaries are named mariadb* instead of mysql*. This requires
some small modifications in our scripts.

Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Michael Halstead <mhalstead@linuxfoundation.org>
This commit is contained in:
Mathieu Dubois-Briand 2025-02-24 11:59:31 +01:00 committed by Michael Halstead
parent cfa5cb410f
commit c4f18608a1
3 changed files with 7 additions and 7 deletions

4
README
View File

@ -412,12 +412,12 @@ To back up the database within the docker-based setup, you can run the
following command (no need to substitute ${MYSQL_ROOT_PASSWORD}, it's
already present within the container environment):
docker-compose exec layersdb /bin/sh -c '/usr/bin/mysqldump -u root --password=${MYSQL_ROOT_PASSWORD} --max_allowed_packet=512M layersdb' | gzip > backup-`date +%Y_%m_%d_%H%M`.sql.gz
docker-compose exec layersdb /bin/sh -c '/usr/bin/mariadb-dump -u root --password=${MYSQL_ROOT_PASSWORD} --max_allowed_packet=512M layersdb' | gzip > backup-`date +%Y_%m_%d_%H%M`.sql.gz
To restore one of these backups you would run the following command (take
care, this will overwrite the data immediately without prompting!):
zcat backupfile.sql.gz | docker-compose exec -T layersdb /bin/sh -c '/usr/bin/mysql -u root --password=${MYSQL_ROOT_PASSWORD} layersdb'
zcat backupfile.sql.gz | docker-compose exec -T layersdb /bin/sh -c '/usr/bin/mariadb -u root --password=${MYSQL_ROOT_PASSWORD} layersdb'

View File

@ -798,7 +798,7 @@ while True:
env = os.environ.copy()
env['MYSQL_PWD'] = dbapassword
# Dummy command, we just want to establish that the db can be connected to
return_code = subprocess.call("echo | docker-compose exec -T -e MYSQL_PWD layersdb mysql -uroot layersdb", shell=True, env=env)
return_code = subprocess.call("echo | docker-compose exec -T -e MYSQL_PWD layersdb mariadb -uroot layersdb", shell=True, env=env)
if return_code == 0:
break
else:
@ -820,7 +820,7 @@ if not args.update:
catcmd = 'cat'
env = os.environ.copy()
env['MYSQL_PWD'] = dbapassword
return_code = subprocess.call("%s %s | docker-compose exec -T -e MYSQL_PWD layersdb mysql -uroot layersdb" % (catcmd, quote(args.databasefile)), shell=True, env=env)
return_code = subprocess.call("%s %s | docker-compose exec -T -e MYSQL_PWD layersdb mariadb -uroot layersdb" % (catcmd, quote(args.databasefile)), shell=True, env=env)
if return_code != 0:
print("Database import failed")
sys.exit(1)
@ -848,7 +848,7 @@ if not args.update:
# (avoids password being visible through ps or /proc/<pid>/cmdline)
env = os.environ.copy()
env['MYSQL_PWD'] = dbapassword
return_code = subprocess.call("docker-compose exec -T -e MYSQL_PWD layersdb mysql -uroot layersdb < " + quote(sqlscriptfile), shell=True, env=env)
return_code = subprocess.call("docker-compose exec -T -e MYSQL_PWD layersdb mariadb -uroot layersdb < " + quote(sqlscriptfile), shell=True, env=env)
if return_code != 0:
print("Creating database user failed")
sys.exit(1)

View File

@ -31,9 +31,9 @@ fi
# This will ask for the password twice, not much we can really do about
# that though
# First, get the structure without data
mysqldump $1 -u root -p --no-data > $2
mariadb-dump $1 -u root -p --no-data > $2
# Second, the data with a number of exclusions
mysqldump $1 -u root -p --no-create-info \
mariadb-dump $1 -u root -p --no-create-info \
--ignore-table=$1.auth_group \
--ignore-table=$1.auth_group_permissions \
--ignore-table=$1.auth_permission \