Quantcast
Channel: Active questions tagged containers - DevOps Stack Exchange
Viewing all articles
Browse latest Browse all 164

from docker container: intermittent error: ERROR 2002 (HY000): Can't connect to local MySQL server through socket

$
0
0

Help me to understand what's happening here with regards to connecting to the database:

root $ root $ docker ps -aCONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMESroot $ root $ docker image lsREPOSITORY           TAG                 IMAGE ID            CREATED             SIZEbasex/basexhttp      latest              3339bf6bc898        3 weeks ago         226MBtwilio/twilio-java   latest              611ab7ece1cf        4 weeks ago         993MBmysql                latest              0d64f46acfd1        6 weeks ago         544MBjetty                latest              5f997007f18d        7 weeks ago         522MBjitsi/web            latest              1fad75476320        2 months ago        483MBmysql/mysql-server   latest              8a3a24ad33be        2 months ago        366MBhello-world          latest              bf756fb1ae65        8 months ago        13.3kBroot $ root $ docker run --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=password -d mysql/mysql-server:latest7b119ef62a857a3b65189f9d79131513ac8d0872f9b93a3f9a507a96bf8d71d3root $ root $ mysql -h127.0.0.1 -ppassword -urootmysql: [Warning] Using a password on the command line interface can be insecure.ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 2root $ root $ mysql -h127.0.0.1 -p -urootEnter password: ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 2root $ root $ mysql -h127.0.0.1 -p -urootEnter password: ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 2root $ root $ docker exec -ti --user root mysql bashbash-4.2# bash-4.2# mysql -u root -pEnter password: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)bash-4.2# bash-4.2# bash-4.2# bash-4.2# mysql -u root -pEnter password: Welcome to the MySQL monitor.  Commands end with ; or \g.Your MySQL connection id is 215Server version: 8.0.21 MySQL Community Server - GPLCopyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> mysql> exitByebash-4.2# exitexitroot $ 

No typo's involved, I just waited a bit and came back. Then it worked. Something about connection pooling perhaps?


Viewing all articles
Browse latest Browse all 164

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>