Can't connect to db localhost

I am having trouble connecting to the memSQL db locally. I followed flask doc’s and I keep getting an error “Cannot connect to MySql Server”. Everything runs well except that. Yes Docker is running. Any help is much appreciated.

1 Like

Are you connecting default socket? Docker can be problematic, try connecting with giving tcp-ip parameters.
Like 127.0.0.1 instead of localhost.

Can you share the dockerfile for the flask app and the docker-compose.yaml you’re using? Are you running both the flask app and MemSQL in the same Docker cluster?

We tried both localhost and 127.0.0.1. None of them works

  1. by locally do you mean the docker host or the docker image itself?
  2. in the docker image check if you are actually listening on the port? lsof -i
  3. check host settings in settings.conf
  4. what is the detailed error msg for “Cannot connect to MySql Server” - especially the error code, this is usually either 2002 or 2003 - but they mean a very different thing
  5. could you try explicitly e.g. mysql --protocol=TCP --host=127.0.0.1 ?
  6. are you trying to connect with e.g. mysql client or memsql studio?