Error on database backup

Hi,

I’m using the following script to backup which is based on https://docs.tutor.overhang.io/tutorials/datamigration.html:

#!/bin/bash
if [ $UID -eq 0 ]; then
	exec su ubuntu "$0" -- "$@"
fi
export COMPOSE_INTERACTIVE_NO_CLI=1
tutor local exec -e MYSQL_ROOT_PASSWORD="$(tutor config printvalue MYSQL_ROOT_PASSWORD)" mysql \
    sh -c 'mysqldump --all-databases --password=$MYSQL_ROOT_PASSWORD > /var/lib/mysql/dump.sql'
tutor local exec mongodb mongodump --out=/data/db/dump.mongodb

However I’m getting the following error:

docker-compose -f /home/ubuntu/.local/share/tutor/env/local/docker-compose.yml -f /home/ubuntu/.local/share/tutor/env/local/docker-compose.prod.yml --project-name tutor_local exec -e MYSQL_ROOT_PASSWORD=mErpRtPK mysql sh -c mysqldump --all-databases --password=$MYSQL_ROOT_PASSWORD > /var/lib/mysql/dump.sql
mysqldump: [Warning] Using a password on the command line interface can be insecure.
mysqldump: Got error: 1146: Table 'openedx.shoppingcart_certificateitem' doesn't exist when using LOCK TABLES
Error: Command failed with status 2: docker-compose -f /home/ubuntu/.local/share/tutor/env/local/docker-compose.yml -f /home/ubuntu/.local/share/tutor/env/local/docker-compose.prod.yml --project-name tutor_local exec -e MYSQL_ROOT_PASSWORD=mErpRtPK mysql sh -c mysqldump --all-databases --password=$MYSQL_ROOT_PASSWORD > /var/lib/mysql/dump.sql

I’m guessing there was an issue on a migration? Any help gratefully received as this is affecting my backup strategy!

-David.

The command you posted works fine in my environment. I have no idea what could cause this issue. Based on some cursory googling, are you quite sure that you database is not corrupted in some way?

Thank you for looking at this.

I think there’s a possibility something went wrong on a recent upgrade which may have led to this. Is there a recommended way of resetting the database and restoring without losing essential data?

Thanks
-David.

You need to try to repair the table maybe with that you will solve it.

https://dev.mysql.com/doc/refman/8.0/en/repair-table.html

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.