cha
cha

Reputation: 740

Can't connect to MYSQL server on '127.0.0.1' (10061) after upgrade docker desktop

Recently I have upgraded docker desktop. Once upgrade finished I tried to connect MYSQL server in localhost. It failed with following error.

> Can't connect to MYSQL server on '127.0.0.1' (10061)

Docker Desktop version - 4.2.0 (70708)

Please let me know how to resolve this if someone have similar experience.

=========================Updates=========================

I'm running php application on laradock.

docker ps -a

    PS D:\Projects\ProjectGroup\laradock> docker ps -a
CONTAINER ID   IMAGE                 COMMAND                  CREATED        STATUS                     PORTS                                                                                                                            NAMES
37b2bb2494fa   b8cd9cd05715          "docker-entrypoint.s…"   3 days ago     Exited (1) 3 days ago                                                                                                                                       practical_swanson
a81d736ffbfe   laradock_beanstalkd   "/usr/bin/beanstalkd"    6 months ago   Up 2 minutes               0.0.0.0:11300->11300/tcp                                                                                                         laradock_beanstalkd_1
aa8c1191224b   laradock_php-fpm      "docker-php-entrypoi…"   6 months ago   Up 2 minutes               9000/tcp, 0.0.0.0:9003->9003/tcp                                                                                                 laradock_php-fpm_1
4a7fdbd4877c   laradock_workspace    "/sbin/my_init"          6 months ago   Up 2 minutes               0.0.0.0:3000-3001->3000-3001/tcp, 0.0.0.0:4200->4200/tcp, 0.0.0.0:8080->8080/tcp, 0.0.0.0:2222->22/tcp, 0.0.0.0:8001->8000/tcp   laradock_workspace_1
ed117dab98a5   laradock_redis        "docker-entrypoint.s…"   6 months ago   Up 2 minutes               0.0.0.0:6379->6379/tcp                                                                                                           laradock_redis_1
b68934b410d8   laradock_apache2      "/opt/docker/bin/ent…"   6 months ago   Up 2 minutes               0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp                                                                                         laradock_apache2_1
b5fa4d4736f1   b8cd9cd05715          "docker-entrypoint.s…"   6 months ago   Exited (1) 2 minutes ago                                                                                                                                    laradock_mysql_1
85bf7864c73d   docker:19.03-dind     "dockerd-entrypoint.…"   6 months ago   Up 2 minutes               2375-2376/tcp                                                                                                                    laradock_docker-in-docker_1
1a778708e98b   b9e19965963f          "/bin/sh -c 'if [ ${…"   2 years ago    Exited (100) 2 years ago                                                                                                                                    hardcore_clarke

==============================Update 2=====================

Mysql container logs

docker-compose logs mysql

    mysql_1  | 2021-11-29T17:22:29.204592Z 0 [Warning] [MY-011070] [Server] 'Disabling symbolic links using --skip-symbolic-links (or equivalent) is the default. Consider not using this option as it' is deprecated and will be removed in a future release.
mysql_1  | 2021-11-29T17:22:29.204632Z 0 [Warning] [MY-010915] [Server] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
mysql_1  | 2021-11-29T17:22:29.204684Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.17) starting as process 1
mysql_1  | 2021-11-29T17:22:29.207006Z 0 [Warning] [MY-013242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
mysql_1  | 2021-11-29T17:22:29.216623Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive
mysql_1  | 2021-11-29T17:22:31.343647Z 1 [ERROR] [MY-011087] [Server] Different lower_case_table_names settings for server ('2') and data dictionary ('0').
mysql_1  | 2021-11-29T17:22:31.343835Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
mysql_1  | 2021-11-29T17:22:31.344056Z 0 [ERROR] [MY-010119] [Server] Aborting
mysql_1  | 2021-11-29T17:22:31.960043Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.17)  MySQL Community Server - GPL.

It seems mysql container shutdown with errors.

Thanks

Upvotes: 0

Views: 1018

Answers (1)

peterh
peterh

Reputation: 1

Probably not the upgrade made your mysql unavailable, but the docker daemon restart which happens with the upgrade.

A docker ps will list your running containers, likely you will see here an empty list. A docker ps -a will list also your not running containers, the mysql will be likely among them.

There is no way to restart a stopped container, but in the docker world, you also do not need it. You have some way to start your mysql container (most likely a docker run ... command), start it again. The persistent data is likely on a docker volume, which is visible for your container, so it will likely not affected by that. (It depends on the container you are using, but that is the typical scenario.)

If you container do not start or your persistent data went off, then probably the container is not very well configured and you have a data recovery task (which will likely have a positive outcome).


Extension: your mysql container (named laradock_mysql_1) has exited and it does not run. It is also created by docker-compose. Restart it (docker compose up -d).


Extension #2: The cause is this: Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive. The mysql container in this compose has a bug, making it not working on windows desktops. /var/lib/mysql is a directory in the container, this is mapped to a directory on your host filesystem. That is a windows, thus the file names are case insensitive (you can access example.tbl also on the name ExAmple.TBL).

It could be relative easily fixed, the mysql configuration has to be changed in the mysql container and possibly a db reinstall might be also needed. The first what I would do in your place: probably there is some override or enforcing flag in the mysql server configuration, to ignore the case insensitivity.

Upvotes: -1

Related Questions