1

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?

Anju
  • 631
  • 2
  • 9
  • 25

1 Answers1

4

Port 6032 is for the administrative CLI. Instead, you would instead want to connect to port 6033 which listens to all traffic and does load balancing towards the backend PXC nodes. Good luck!

  • Hi can you please tell me what user and password we should provide while connecting to proxysql using port 6033 and how that user will be created and have all the privileges – Rahul Tokase Apr 15 '19 at 22:47
  • ProxySQL works as a middle man in terms of authentication. Database users will have to be created on ProxySQL itself, in mysql_users table. ProxySQL doesn't need anything more than username and password (it can be either plain text or, better, hash). Application will connect to ProxySQL using user and password to authenticate. Then ProxySQL will use the same user and password to create connections to the backend servers. Privileges are tested only on the MySQL side. More in this ProxySQL tutorial (https://severalnines.com/resources/tutorials/proxysql-tutorial-mysql-mariadb). – Vinay Joosery Apr 17 '19 at 06:23