Home > front end >  Mysql login gives error: Keyring migration failed
Mysql login gives error: Keyring migration failed

Time:01-18

I'm trying to set up a docker container running mysql server. I'm following the steps from the official image.

More precisely, I'm running the following commands, each in their own powershell prompt:

docker run -it --rm --name MySql_EC `
    -e MYSQL_ROOT_PASSWORD=ecdev `
    -v MySql_ec:/var/lib/mysql:rw `
    mysql 

and

docker run -it --rm --name mysql2 `
    mysql -h localhost -u root -p

When I run the second command, I'm prompted for a password. I enter ecdev, and then I get the following error:

2023-01-17 08:01:05 00:00 [ERROR] [Entrypoint]: mysqld failed while attempting to check config
        command was: mysqld -h localhost -u root -p --verbose --help --log-bin-index=/tmp/tmp.ZpxXEJPHAJ
        mysqld: Can not perform keyring migration : Invalid --keyring-migration-source option.
2023-01-17T08:01:05.180474Z 0 [ERROR] [MY-011084] [Server] Keyring migration failed.
2023-01-17T08:01:05.181137Z 0 [ERROR] [MY-010119] [Server] Aborting

I was expecting a MySql repl. Instead I'm back at powershell.

CodePudding user response:

So, assuming you want to do the "Connect to MySQL from the MySQL command line client" part of your linked documentation, you have two problems.

  1. Your second Docker run command is incomplete as you don't name the image.
  2. You want to connect to localhost, but with the second command you create a second container which refers to itself by localhost.

The following should work:

docker network create mysql-net

docker run -it --rm --name MySql_EC --network mysql-net `
    -e MYSQL_ROOT_PASSWORD=ecdev `
    -v MySql_ec:/var/lib/mysql:rw `
    mysql:latest

docker run -it --rm --name mysql2 --network mysql-net `
    mysql:latest mysql -h MySql_EC -u root -p

I only wrote mysql:latest in order to help you to distinguish between the image name parameter and the command that will be executed in the container after its creation. You can replace mysql:latest with mysql.

If you don't want to create and assign a network, you cannot refer to your parent container with the container name. However, you can do a docker inspect to get the IP of the container and connect through that.

  • Related