0

I am using below command to create a docker swarm service.

docker service create --name mysql_2 -p target=3306 -e MYSQL_DATABASE=mydb -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:latest

After service creation, when I try to connect mysql database using dbeaver, got below error.

db error 1

I changed allowPublicKeyRetrievel to TRUE but still same issue.

Michael Hampton
  • 244,070
  • 43
  • 506
  • 972
uday kiran
  • 33
  • 6
  • Have you tried to find solutions on the internet? For example, https://qiita.com/shaching/items/5fe3d5df691b4ec53084. Or try an earlier version of MySQL. – berndbausch Jan 01 '21 at 23:18
  • Here in the above link, it is mentioned to change the configuration file in the mysql image.In that case, we need to modify every time and create a new image for every new tag released for official repo. Is there any other option.? – uday kiran Jan 04 '21 at 08:24
  • You either have to configure dbeaver to use the new authentication method, or configure the mysql container to use the old authentication method. If neither is possible, you have to use MySQL 5.7 (the most recent version before 8, if I am not wrong), or create your own mysql image. – berndbausch Jan 06 '21 at 02:37
  • According to https://hub.docker.com/_/mysql, you can configure the container like this: `$ docker run --name some-mysql -v /my/custom:/etc/mysql/conf.d -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:tag` – berndbausch Jan 06 '21 at 02:40
  • that is for mapping volumes.But everytime, the config file might change other data also along with this – uday kiran Jan 06 '21 at 07:24
  • That is for mapping your config to the mysql container. I don't know why changes in the config are a problem for you. After all, you *need* to change the configuration in order to use the old authentication method. In any case, I can offer you the following options: Use mysql version 5.7.x, or change the dbeaver config to use a different authentication method (I don't know if that can be done), or map a different configuration to the mysql 8.x container. I have no other solution. – berndbausch Jan 06 '21 at 09:13
  • config file mapping contains many options, not just this.Correct me if I am wrong.If I use a static config file like this. If any new updates comes to this docker image from official repo, then those changes will be missed. And also, if I spin multiple contianers then all of them will point to the same config file, how to manage here? – uday kiran Jan 06 '21 at 09:30
  • The volume corresponds to */etc/mysql.conf.d* in the container. This means that you only put your own configuration settings in it; you don't overwrite the entire *my.cnf*. If you run multiple containers, you have the choice of sharing the configuration or giving each container its own configuration. – berndbausch Jan 06 '21 at 09:44

0 Answers0