0

I installed docker, got the most popular box with proxySQL.

docker run -d -p 6032:6032 --name proxysql prima/proxysql:latest

then I tried to connect to it from my local mysql like so:

mysql -u admin -padmin -h 127.0.0.1 -P6032

and I'm getting this error:

ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 0 "Internal error/check (Not system error)"

I tried this trick with twindb/proxysql:latest and prima/proxysql:latest docker images and the result was the same :(

Yevgeniy Afanasyev
  • 37,872
  • 26
  • 173
  • 191
  • are you sure about the ports. The Dockerfile for the image doesn't declare any exposed ports and the default config file seems to be using another port. – yamenk Sep 20 '17 at 06:03
  • 6032 is a default port for proxySQL as it is stated [here](https://github.com/sysown/proxysql/wiki/ProxySQL-Configuration) and [here](https://github.com/sysown/proxysql/wiki). If I specify another port in mySQL connection request, I'm getting `ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (61 "Connection refused")` – Yevgeniy Afanasyev Sep 20 '17 at 06:38

2 Answers2

3

You cannot connect to proxysql from outside the container in default config. bash into the proxysql container and then execute

 mysql -u admin -p<password-here> -h 127.0.0.1 -P 6032 --prompt='proxysql>'

default password will be the admin

Vineeth Sai
  • 3,389
  • 7
  • 23
  • 34
2

You need to map 6033 instead of 6032

docker run -d 6033:6033 --name proxysql prima/proxysql:latest

And then run below

mysql -u admin -padmin -h 127.0.0.1 -P6033

Inside the container mysql listens on 127.0.0.1:6032 and for outside connections it listens on 0.0.0.0:6033. So you need to use 6033 for connections from outside the container

Tarun Lalwani
  • 142,312
  • 9
  • 204
  • 265
  • Thanks, it moves me further. Now I have different error saying: `ERROR 1045 (28000): ProxySQL Error: Access denied for user 'admin' (using password: YES)`. And It is clear what to do next. Thanks. – Yevgeniy Afanasyev Sep 26 '17 at 01:26
  • Note that if you want to be able to access the admin configuration database as well, you'll still need to map port `6032`. So in that case I would map both ports, e.g. `-p 6033:6033 -p 6032:6032` – Matt Browne May 27 '20 at 15:12