I was finally successful restoring the data. My problem was, that I tried to restore the data with a docker-compose
, which somehow didn't work.
So I took a different approach
1. Run a docker image of mysql:8
and mounted the "corrupt" folder to it
docker run -d -e MYSQL_ROOT_PASSWORD=root -v /path/to/corrupt/folder:/var/lib/mysql --name mrestore mysql:8
The mysql-server started without any problems and I was able to run mysql with
mysql -u root -p
.
But when I run the command mysql>show databases;
It gave me an error like:
The user specified as a definer ('mysql.infoschema'@'localhost') does not exist
2. Fix user does not exist error
A quick google search led me to the answer of someone having the same problem: https://stackoverflow.com/questions/49992868/mysql-errorthe-user-specified-as-a-definer-mysql-infoschemalocalhost-doe
Which is:
mysql -u root -p
mysql> SET GLOBAL innodb_fast_shutdown = 1;
mysql_upgrade -u root -p
3. Dump databse
Finally I was able to start mysql and dump the database that I thought I've lost
mysqldump -u root -p databasename > databasename.sql
You can run util.check_for_server_upgrade()
with a Mysql user who has the ALL PRIVILEGES
. As you are using AWS RDS your master MySQL user don't have SUPER user
permission, that's why your are getting this error, you can check your user permission with SHOW GRANTS FOR 'user'@'host'
.
Only rdsadmin
user have the ALL PRIVILEGES
in AWS RDS MySQL
instance. rdsadmin
is amazon's own user that is used by Amazon to perform release or version update, taking backups and other maintenance tasks. Amazon's support should be able to advise you better in this topics.
Best Answer
Looks like there is a bug reported for this. Hope this helps someone.
https://bugs.mysql.com/bug.php?id=101969