# I am not able to connect to mysql using proxySQL

**URL:** <https://forums.percona.com/t/i-am-not-able-to-connect-to-mysql-using-proxysql/29742>\
**Category:** Percona XtraDB Cluster 5.x\
**Tags:** mysql\
**Created:** [April 18, 2024, 6:31am UTC](https://forums.percona.com/t/i-am-not-able-to-connect-to-mysql-using-proxysql/29742 "2024-04-18T06:31:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![erpramodprajapat](https://avatars.discourse-cdn.com/v4/letter/e/c37758/32.png) [@erpramodprajapat](https://forums.percona.com/u/erpramodprajapat)\
**Post date:** [April 18, 2024, 6:31am UTC](https://forums.percona.com/t/i-am-not-able-to-connect-to-mysql-using-proxysql/29742/1 "2024-04-18T06:31:49Z")

</div>

I have AWS application pods , I have deployed ProxySQL pods in AWS Kubernetes, I am able to connect to MySQL from inside the proxySQL pods like  
mysql -uuser -ppassw0rd -h 127.0.0.1 -P 6033  
but I am not able to connect from my application pods with host as svc/end point  
mysql -uuser -ppassw0rd -h proxysql-cluster -P 6033

its hanging there only no error comes also  
some times getting error reading initial communication packet

What I am doing wrong ,  
is there any configuration where I can define that proxycluster can accept connection from any IP or IP/range

---

<div class="post-metadata">

**Author:** ![anil.joshi](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/anil.joshi/32/13100_2.png) [@anil.joshi](https://forums.percona.com/u/anil.joshi)\
**Post date:** [April 20, 2024, 9:01am UTC](https://forums.percona.com/t/i-am-not-able-to-connect-to-mysql-using-proxysql/29742/2 "2024-04-20T09:01:03Z")

</div>

@erpramodprajapat

> is there any configuration where I can define that proxycluster can accept connection from any IP or IP/range

Basically, you have to expose the ProxySQL service to outside access.

E.g,  
`kubectl expose service proxysql --type=LoadBalancer --name=my-service`

Also you can define the same in your deployment[cr.yaml] file with respect to the ProxySQL.

```auto
expose:
      serviceType: LoadBalancer

```

Please verify if your service is already exposed for remote accesses.

> **[Percona Operator for MySQL based on Percona XtraDB Cluster - Exposing the...](https://docs.percona.com/percona-operator-for-mysql/pxc/expose.html#exposing-cluster-with-haproxy-or-proxysql)**
>
> Percona Operator for MySQL based on Percona XtraDB Cluster provides entry points for accessing the database by client
> applications in several scenarios. In either way the cluster is exposed with
> regular Kubernetes Service objects,
> configured by the...

> **[Percona Operator for MySQL based on Percona XtraDB Cluster - Custom Resource...](https://docs.percona.com/percona-operator-for-mysql/pxc/operator.html#proxysql-section)**
>
> Percona Operator for MySQL uses Custom Resources to manage options for the various components of the cluster.

> **[Percona Operator for MySQL based on Percona XtraDB Cluster - Exposing the...](https://docs.percona.com/percona-operator-for-mysql/pxc/expose.html#exposing-cluster-with-haproxy-or-proxysql)**
>
> Percona Operator for MySQL based on Percona XtraDB Cluster provides entry points for accessing the database by client
> applications in several scenarios. In either way the cluster is exposed with
> regular Kubernetes Service objects,
> configured by the...

Are you using Percona K8s operator or some native k8s setup ?

---

<div class="post-metadata">

**Author:** ![erpramodprajapat](https://avatars.discourse-cdn.com/v4/letter/e/c37758/32.png) [@erpramodprajapat](https://forums.percona.com/u/erpramodprajapat)\
**Post date:** [April 23, 2024, 4:48am UTC](https://forums.percona.com/t/i-am-not-able-to-connect-to-mysql-using-proxysql/29742/3 "2024-04-23T04:48:05Z")

</div>

Thank you @anil.joshi I am using AWS k8s, I don’t want to expose the load balancer due to security risk, I want my application pods K8s network only to access proxy sql so that I can connect to MySQL
