proxysql - High-performance MySQL proxy with a GPL license. ProxySQL proxysql: high-performance, gpl licensed mysql proxy. it supports hundreds of thousands of concurrent connections and can be multiplexed to hundreds of servers.

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

Source: (StackOverflow)

How to connect to ProxySQL from application

I have Percona XtraDB Cluster running in 3 nodes (node1, node2, node3). I've configured ProxySQL in the 4th node (admin).

I have an python application code trying to access the cluster.

While connecting to 3306 port of node1, I'm able to connect.

import MySQLdb as mdb
db = mdb.connect(host="node1", port=3306,user="root", passwd="*****", db="percona")

In order to achieve load balancing, the application should point to the ProxySQL port 6032.

import MySQLdb as mdb
db = mdb.connect(host="admin", port=6032,user="admin", passwd="*****", db="percona")

While trying to connect, I'm getting the following error:

OperationalError: (1045, "ProxySQL Error: Access denied for user 'admin'@'' (using password: YES)")

I used the grant privilages command in the proxysql

grant all privileges on percona.* to 'admin'@'%' identified by password 'bullet';

Unfortunately, I got the following error,

ERROR 1045 (#2800): near "grant": syntax error

Correct me if I'm wrong.

Should I use some other configuration to connect to the Percona XtraDB Cluster?

Source: (StackOverflow)