writehat icon indicating copy to clipboard operation
writehat copied to clipboard

connection issue to mysql

Open GreenKnightDigital opened this issue 2 years ago • 4 comments

I keep getting django.db.utils.OperationalError: (2003, "Can't connect to MySQL server on '127.0.0.1' ([Errno 111] Connection refused)")

I have changed 'mysql' to '127.0.0.1' in the writehat.conf file to try and fix the issue but I get this error either way.

The connection failure happens in the socket.py file

GreenKnightDigital avatar Jul 07 '22 04:07 GreenKnightDigital

Check docker ps -a, is the writehat MySQL container running? If yes, are the credentials correct? Can you login to it manually using MySQL command line tool?

thejohnbrown avatar Jul 07 '22 07:07 thejohnbrown

Okay so I ran the following docker-compose up --build this met with the same error docker-compose up -d no error docker ps -a the MySQL database was running I check through all of the passwords and they all matched docker-compose exec mysql bash got in with no problem mysql -u writehat -p I used the password I had set and I was denied access

Also I tried docker-compose exec writehat bash and this just keeps restarting

GreenKnightDigital avatar Jul 07 '22 13:07 GreenKnightDigital

Just noticed these warnings while running docker-compose down

WARNING: The t2897 variable is not set. Defaulting to a blank string. WARNING: The t6216 variable is not set. Defaulting to a blank string

GreenKnightDigital avatar Jul 07 '22 13:07 GreenKnightDigital

I'm having difficulty reproducing this, however it is pretty normal to see mysql-related errors when bringing up docker-compose, since the mysql container takes a long time to start.

Can you make sure you're operating from a fresh clone of writehat, and then run docker-compose down before you run docker-compose up? You can paste the output of docker-compose up here.

TheTechromancer avatar Jul 13 '22 18:07 TheTechromancer

Seeing how OP hasn't responded anymore, please go ahead and close this issue report.

unixerius avatar May 13 '24 12:05 unixerius