# Getting error while trying to execute basic queries like show databases / select version, etc

**URL:** <https://forums.percona.com/t/getting-error-while-trying-to-execute-basic-queries-like-show-databases-select-version-etc/7875>\
**Category:** Percona Operator for MySQL\
**Tags:** mysql\
**Created:** [August 10, 2020, 4:49am UTC](https://forums.percona.com/t/getting-error-while-trying-to-execute-basic-queries-like-show-databases-select-version-etc/7875 "2020-08-10T04:49:24Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![saloni24](https://avatars.discourse-cdn.com/v4/letter/s/c77e96/32.png) [@saloni24](https://forums.percona.com/u/saloni24)\
**Post date:** [August 10, 2020, 4:49am UTC](https://forums.percona.com/t/getting-error-while-trying-to-execute-basic-queries-like-show-databases-select-version-etc/7875/1 "2020-08-10T04:49:24Z")

</div>

Errors observed in monitoring logs:-lookup symclass-mysql-cluster-proxysql-unready on 172.27.0.10:53: no such host-ProxySQL Admin Error: UNIQUE constraint failed: proxysql\_servers.hostname, proxysql\_servers.port-ERROR 2003 (HY000): Can’t connect to MySQL server on ‘127.0.0.1’ (111)-ERROR 2005 (HY000): Unknown MySQL server host  
Does anyone has any idea regarding the same?

---

<div class="post-metadata">

**Author:** ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)\
**Post date:** [August 12, 2020, 12:02pm UTC](https://forums.percona.com/t/getting-error-while-trying-to-execute-basic-queries-like-show-databases-select-version-etc/7875/2 "2020-08-12T12:02:21Z")

</div>

It looks like your K8s DNS is not functioning properly (ie:&nbsp;172.27.0.10:53: no such host) Port 53 is the DNS lookup port and things are unable to reach it. This may be why ProxySQL is failing in it’s setup.

---

<div class="post-metadata">

**Author:** ![lokesh123](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/lokesh123/32/5519_2.png) [@lokesh123](https://forums.percona.com/u/lokesh123)\
**Post date:** [November 3, 2020, 7:52am UTC](https://forums.percona.com/t/getting-error-while-trying-to-execute-basic-queries-like-show-databases-select-version-etc/7875/3 "2020-11-03T07:52:59Z")

</div>

mysql -u sbuser -p -h 127.0.0.1 -P 6033

Enter password:

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 3

Server version: proxysql (ProxySQL)

Copyright (c) 2009-2020 Percona LLC and/or its affiliates

Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql\> show databases;

ERROR 2013 (HY000): Lost connection to MySQL server during query

mysql\>

mysql\> show databases;

ERROR 2006 (HY000): MySQL server has gone away

No connection. Trying to reconnect…

Connection id: 4

Current database: \*\*\* NONE \*\*\*

ERROR 9001 (HY000): Max connect timeout reached while reaching hostgroup 0 after 10012ms

mysql\>

any idea @matthewb

---

<div class="post-metadata">

**Author:** ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)\
**Post date:** [November 3, 2020, 8:47am UTC](https://forums.percona.com/t/getting-error-while-trying-to-execute-basic-queries-like-show-databases-select-version-etc/7875/4 "2020-11-03T08:47:38Z")

</div>

- Can you connect to the ProxySQL Admin and do ‘SELECT \* FROM runtime\_mysql\_servers’?

- Are all 4 pods online? (kubectl get pods)
- Can you connect directly to each MySQL backend?

---

<div class="post-metadata">

**Author:** ![lokesh123](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/lokesh123/32/5519_2.png) [@lokesh123](https://forums.percona.com/u/lokesh123)\
**Post date:** [November 3, 2020, 8:51am UTC](https://forums.percona.com/t/getting-error-while-trying-to-execute-basic-queries-like-show-databases-select-version-etc/7875/5 "2020-11-03T08:51:31Z")

</div>

@matthewb

mysql\> SELECT \* FROM runtime\_mysql\_servers;

±-------------±-------------±-----±----------±-------±-------±------------±----------------±--------------------±--------±---------------±--------+

| hostgroup\_id | hostname | port | gtid\_port | status | weight | compression | max\_connections | max\_replication\_lag | use\_ssl | max\_latency\_ms | comment |

±-------------±-------------±-----±----------±-------±-------±------------±----------------±--------------------±--------±---------------±--------+

| 0 | 192.168.0.1 | 3306 | 0 | ONLINE | 1 | 0 | 1000 | 0 | 0 | 0 | |

| 0 | 192.168.0.2 | 3306 | 0 | ONLINE | 1 | 0 | 1000 | 0 | 0 | 0 | |

| 0 | 192.168.0.3 | 3306 | 0 | ONLINE | 1 | 0 | 1000 | 0 | 0 | 0 | |

±-------------±-------------±-----±----------±-------±-------±------------±----------------±--------------------±--------±---------------±--------

I am trying to setup in Racspace …percona cluster is working fine.

but some issues with proxysql.

---

<div class="post-metadata">

**Author:** ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)\
**Post date:** [November 3, 2020, 8:58am UTC](https://forums.percona.com/t/getting-error-while-trying-to-execute-basic-queries-like-show-databases-select-version-etc/7875/6 "2020-11-03T08:58:55Z")

</div>

@lokesh123 I listed 3 tasks in the previous message. Can you please do all three ?

---

<div class="post-metadata">

**Author:** ![lokesh123](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/lokesh123/32/5519_2.png) [@lokesh123](https://forums.percona.com/u/lokesh123)\
**Post date:** [November 3, 2020, 9:02am UTC](https://forums.percona.com/t/getting-error-while-trying-to-execute-basic-queries-like-show-databases-select-version-etc/7875/7 "2020-11-03T09:02:39Z")

</div>

@matthewb

yes I am able to connect mysql backend.

and these are stand alone servers not on kubernet containers.

---

<div class="post-metadata">

**Author:** ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)\
**Post date:** [November 3, 2020, 9:20am UTC](https://forums.percona.com/t/getting-error-while-trying-to-execute-basic-queries-like-show-databases-select-version-etc/7875/8 "2020-11-03T09:20:36Z")

</div>

@lokesh123You posted this question inside the ‘Percona Kubernetes Operator for Percona XtraDB Cluster’ forum, so naturally, one would assume that Kubernetes is involved here.

In ProxySQL admin, please run each of the following. Please also use the forum formatting tools when pasting console output:

```auto
SELECT * FROM runtime_mysql_galera_hostgroups;
SELECT * FROM runtime_mysql_users;
SELECT hostname, connect_error FROM mysql_server_connect_log ORDER BY time_start_us DESC LIMIT 10;

```

Please run all 3.

---

<div class="post-metadata">

**Author:** ![lokesh123](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/lokesh123/32/5519_2.png) [@lokesh123](https://forums.percona.com/u/lokesh123)\
**Post date:** [November 3, 2020, 9:59am UTC](https://forums.percona.com/t/getting-error-while-trying-to-execute-basic-queries-like-show-databases-select-version-etc/7875/9 "2020-11-03T09:59:17Z")

</div>

@matthewb

mysql\> SELECT \* FROM runtime\_mysql\_galera\_hostgroups;

Empty set (0.00 sec)

mysql\> SELECT \* FROM runtime\_mysql\_users;

±---------±------------------------------------------±-------±--------±------------------±---------------±--------------±-----------------------±-------------±--------±---------±----------------±--------+

| username | password | active | use\_ssl | default\_hostgroup | default\_schema | schema\_locked | transaction\_persistent | fast\_forward | backend | frontend | max\_connections | comment |

±---------±------------------------------------------±-------±--------±------------------±---------------±--------------±-----------------------±-------------±--------±---------±----------------±--------+

| sbuser | \*A963A39DD5801D80DEE9205ECEF04B4E843FC4CD | 1 | 0 | 0 | | 0 | 1 | 0 | 0 | 1 | 10000 | |

| sqlproxy | \*A963A39DD5801D80DEE9205ECEF04B4E843FC4CD | 1 | 0 | 0 | | 0 | 1 | 0 | 0 | 1 | 10000 | |

| sbuser | \*A963A39DD5801D80DEE9205ECEF04B4E843FC4CD | 1 | 0 | 0 | | 0 | 1 | 0 | 1 | 0 | 10000 | |

| sqlproxy | \*A963A39DD5801D80DEE9205ECEF04B4E843FC4CD | 1 | 0 | 0 | | 0 | 1 | 0 | 1 | 0 | 10000 | |

±---------±------------------------------------------±-------±--------±------------------±---------------±--------------±-----------------------±-------------±--------±---------±----------------±--------+

4 rows in set (0.00 sec)

mysql\> SELECT hostname, connect\_error FROM mysql\_server\_connect\_log ORDER BY time\_start\_us DESC LIMIT 10;

±-------------±--------------+

| hostname | connect\_error |

±-------------±--------------+

| 192.168.0.1 | NULL |

| 192.168.0.2 | NULL |

| 192.168.0.3 | NULL |

| 192.168.0.1 | NULL |

| 192.168.0.2 | NULL |

| 192.168.0.3 | NULL |

| 192.168.0.1 | NULL |

| 192.168.0.2 | NULL |

| 192.168.0.3 | NULL |

| 192.168.0.1 | NULL |

±-------------±--------------+

10 rows in set (0.00 sec)

---

<div class="post-metadata">

**Author:** ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)\
**Post date:** [November 3, 2020, 10:09am UTC](https://forums.percona.com/t/getting-error-while-trying-to-execute-basic-queries-like-show-databases-select-version-etc/7875/10 "2020-11-03T10:09:16Z")

</div>

@lokesh123Please use the forum formatting to paste output. Very difficult to read.

There appears to be no issues with ProxySQL connecting to the backend servers.

mysql\_galera\_hostgroups is empty. You need to configure this table so that proxysql is aware of PXC node states.

Please run this:

```auto
mysql -h 127.0.0.1 -P 6033 -u sbuser -p -e "SELECT @@hostname"

```

---

<div class="post-metadata">

**Author:** ![lokesh123](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/lokesh123/32/5519_2.png) [@lokesh123](https://forums.percona.com/u/lokesh123)\
**Post date:** [November 3, 2020, 10:59am UTC](https://forums.percona.com/t/getting-error-while-trying-to-execute-basic-queries-like-show-databases-select-version-etc/7875/11 "2020-11-03T10:59:57Z")

</div>

sorry not able to get How to use formatting tools?

@matthewb

mysql\> select \* from mysql\_galera\_hostgroups ;

±-----------------±------------------------±-----------------±------------------±-------±------------±----------------------±------------------------±--------+

| writer\_hostgroup | backup\_writer\_hostgroup | reader\_hostgroup | offline\_hostgroup | active | max\_writers | writer\_is\_also\_reader | max\_transactions\_behind | comment |

±-----------------±------------------------±-----------------±------------------±-------±------------±----------------------±------------------------±--------+

| 10 | 12 | 11 | 13 | 1 | 1 | 2 | 100 | NULL |

±-----------------±------------------------±-----------------±------------------±-------±------------±----------------------±------------------------±--------+

1 row in set (0.00 sec)

root@prod-db-01:/var/lib/proxysql# mysql -h 127.0.0.1 -P 6033 -u sbuser -p -e “SELECT @@hostname”

Enter password:

ERROR 9001 (HY000) at line 1: Max connect timeout reached while reaching hostgroup 11 after 10011ms

still getting same issue.

---

<div class="post-metadata">

**Author:** ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)\
**Post date:** [November 3, 2020, 11:14am UTC](https://forums.percona.com/t/getting-error-while-trying-to-execute-basic-queries-like-show-databases-select-version-etc/7875/12 "2020-11-03T11:14:04Z")

</div>

@lokesh123 Click the icon to the left of the comment box to format using “code” style.

I see your galera hostgroups are 10 (writer), and 11(reader). But when you sent mysql\_servers, all 3 had hostgroup 0. You need to fix that. Update mysql\_servers and set one server to 10 and the other 2 to 11. Save/Load mysql servers to runtime.
