mysqldockerproxysql

How to connect to ProxySQL with default config on Docker


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 :(


Solution

  • 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