# \[APP\]\[PRO\] MySQL-Client

**URL:** <https://community.homey.app/t/app-pro-mysql-client/62459>\
**Category:** Apps\
**Tags:** app, tools, homey-pro\
**Created:** [April 7, 2022, 7:18pm UTC](https://community.homey.app/t/app-pro-mysql-client/62459 "2022-04-07T19:18:16Z")\
**Posts on this page:** 20\
**Page:** 5

<div class="post-metadata">

**Author:** ![RonnyW](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ronnyw/32/10879_2.png) [@RonnyW](https://community.homey.app/u/RonnyW)\
**Post date:** [March 26, 2025, 4:21pm UTC](https://community.homey.app/t/app-pro-mysql-client/62459/81 "2025-03-26T16:21:00Z")

</div>

The flow card you are using is doing all in once:

- connect
- execute query
- end connection

If the query errors somehow (thrown an error), the process is aborted and the flow card throws an error (error output). In this case, the “end connection” is not done.  
If you get an EHOSTUNREACH error, it should be already happen on connect try. Then it doesn’t make sense to try to end the connection if it couldn’t be established yet.

Perhaps the connect already opens the connection at the server but your Homey doesn’t get a response. This could cause an open connection. But the question would be: why does the server accept/open the connection without responding.

---

<div class="post-metadata">

**Author:** ![Pat\_M](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/pat_m/32/56295_2.png) [@Pat\_M](https://community.homey.app/u/Pat_M)\
**Post date:** [March 26, 2025, 4:37pm UTC](https://community.homey.app/t/app-pro-mysql-client/62459/82 "2025-03-26T16:37:30Z")

</div>

Thank you so much for quick response RonnyW - I appreciate it!  
So, we both agree on that EHOSTUNREACH should not invoke a OPEN (thus no need to close). And EHOSTUNREACH are the only errors I got (all other are checked and correct).

I guess (and hope) that one instance are isolated, so many different flows does not interfere or mix up OPEN/CLOSE, right?

Ex:  
Flow 1: … open, query, close  
Flow 2: … open, query, close  
Flow 3: … open, query, close  
Flow 4: … open, query, close

Thanks!

---

<div class="post-metadata">

**Author:** ![RonnyW](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ronnyw/32/10879_2.png) [@RonnyW](https://community.homey.app/u/RonnyW)\
**Post date:** [March 26, 2025, 4:45pm UTC](https://community.homey.app/t/app-pro-mysql-client/62459/83 "2025-03-26T16:45:57Z")

</div>

Well, if the connection is opened at the server even if you get a connect error, then all connect attempts could leave an open connection.

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [March 26, 2025, 4:51pm UTC](https://community.homey.app/t/app-pro-mysql-client/62459/84 "2025-03-26T16:51:38Z")

</div>

Looking at the code, there are a few possibilities that can result in dangling connections:

```auto
await connection.connect();
await connection.ping();     
await connection.end();  

```

If `ping()` fails, for whatever reason, the connection isn’t closed.

```auto
await connection.connect();
let databases = await connection.query("SHOW DATABASES");  
await connection.end();

```

If `query()` fails, for whatever reason, the connection isn’t closed.

It might be better to _always_ end the connection in a `finally`:

```auto
let connection;

try {
  connection = await mysql.createConnection({
      host : settings.host,
      port : settings.port,
      user : settings.user,
      password : settings.pw
  });

  await connection.connect();
  await connection.ping();     
  await connection.end();   
  return true;
} catch (error) {
  throw error;
} finally {
  if (connection) connection.end();
}

```

(I’m not sure if you also need to check if `connection` is actually connected before you call `.end()` and I’m too lazy to RTFM 😉 )

---

<div class="post-metadata">

**Author:** ![RonnyW](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ronnyw/32/10879_2.png) [@RonnyW](https://community.homey.app/u/RonnyW)\
**Post date:** [March 26, 2025, 5:09pm UTC](https://community.homey.app/t/app-pro-mysql-client/62459/85 "2025-03-26T17:09:09Z")

</div>

Thanks, Robert. I also saw the 3 calls in a line. I just thought on query I would get another error.  
Using finally is a good point.

---

<div class="post-metadata">

**Author:** ![Pat\_M](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/pat_m/32/56295_2.png) [@Pat\_M](https://community.homey.app/u/Pat_M)\
**Post date:** [March 26, 2025, 6:41pm UTC](https://community.homey.app/t/app-pro-mysql-client/62459/86 "2025-03-26T18:41:21Z")

</div>

Thanks guys for looking into this.

As I haven’t recently changed any flows etc and the app hasn’t been changed but my Internet seems flaky, my _feeling_ is that this hopefully (?) is an edge-case where my bad Internet stress-testes both the app and Homey in particular, in an unfair way.

It happened with an calendar app last fall, for some weeks, and sometimes Zigbee will fail for days and Z-wave will stop work for new inclusions.

I will disable the MySQL app for now, in order to get my web site back and hopefully my Internet and Homey will magically be cured again in hopefully not to long time!

Thanks again!

---

<div class="post-metadata">

**Author:** ![RonnyW](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ronnyw/32/10879_2.png) [@RonnyW](https://community.homey.app/u/RonnyW)\
**Post date:** [March 28, 2025, 3:00pm UTC](https://community.homey.app/t/app-pro-mysql-client/62459/87 "2025-03-28T15:00:12Z")

</div>

New **live version 1.0.5** :

- Force close connection on error.

@Pat_M FYI and to try:

> **[MySQL](https://homey.app/en-us/app/de.ronnywinkler.mysql/MySQL/)**
>
> Access your MySQL database from Homey

---

<div class="post-metadata">

**Author:** ![HvN](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/hvn/32/56789_2.png) [@HvN](https://community.homey.app/u/HvN)\
**Post date:** [March 28, 2025, 9:30pm UTC](https://community.homey.app/t/app-pro-mysql-client/62459/88 "2025-03-28T21:30:42Z")

</div>

Since this version, I have been encountering issues with the MySQL server, specifically an overflow of existing connections. It seems that old connections are no longer being closed. I quickly receive the message: _“Too many connections.”_ I will disable the MySQL communication flows for now. Hopefully, you can look into this issue and release an update.

I have already restarted the Homey MySQL app, the MySQL service, and even the entire server. I also tried increasing the `max_connections` variable, but that does not seem to be the issue.

---

<div class="post-metadata">

**Author:** ![RonnyW](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ronnyw/32/10879_2.png) [@RonnyW](https://community.homey.app/u/RonnyW)\
**Post date:** [March 28, 2025, 9:44pm UTC](https://community.homey.app/t/app-pro-mysql-client/62459/89 "2025-03-28T21:44:35Z")

</div>

Thanks for the hint. You are right. I missed to adapt a small part.

New version 1.0.6 should fix the issue.

---

<div class="post-metadata">

**Author:** ![HvN](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/hvn/32/56789_2.png) [@HvN](https://community.homey.app/u/HvN)\
**Post date:** [March 29, 2025, 6:53am UTC](https://community.homey.app/t/app-pro-mysql-client/62459/90 "2025-03-29T06:53:32Z")

</div>

Thanks, Ronny. I see that everything worked fine with the new version. Many thanks for the very quick fix!

---

<div class="post-metadata">

**Author:** ![Pat\_M](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/pat_m/32/56295_2.png) [@Pat\_M](https://community.homey.app/u/Pat_M)\
**Post date:** [March 29, 2025, 12:22pm UTC](https://community.homey.app/t/app-pro-mysql-client/62459/91 "2025-03-29T12:22:12Z")

</div>

Very good news, I will try this on Monday when my ISP is active. Thanks RonnyW for quick fix, super hopeful this will work!!

---

<div class="post-metadata">

**Author:** ![Soeren\_Holm](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/soeren_holm/32/121141_2.png) [@Soeren\_Holm](https://community.homey.app/u/Soeren_Holm)\
**Post date:** [March 31, 2025, 2:28pm UTC](https://community.homey.app/t/app-pro-mysql-client/62459/92 "2025-03-31T14:28:51Z")

</div>

After 1.0.5 - 1.0.6, the app still show installed, but not running, when try to restart it say app not installed, tried to reinstall + reboot in several combination, but end result same, app show installed, but can not add client, and when trying to restart, it says app not installed ☹ love the app 🙂  
b1d0b559-296a-43c7-a948-8a1abce1d8be

---

<div class="post-metadata">

**Author:** ![RonnyW](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ronnyw/32/10879_2.png) [@RonnyW](https://community.homey.app/u/RonnyW)\
**Post date:** [March 31, 2025, 3:14pm UTC](https://community.homey.app/t/app-pro-mysql-client/62459/93 "2025-03-31T15:14:41Z")

</div>

It seems you are also affected by this issue…

> [@Cannot add new apps to Homey suddenly](https://community.homey.app/t/cannot-add-new-apps-to-homey-suddenly/133411):
>
> Hi, all of a sudden, I cannot add any new apps to Homey (early 2019). It says “app will be installed shortly” like usual, but nothing happens - the new app does not appear in the list of other installed apps. having like 30 apps, no problems so far for years tried in the mobile app as well as in the web based one logged out from the app, logged in again restarted Homey twice tried adding like 5 different random apps uninstalled one unused app (Timer), cannot add it back a minute after as far a…

Are you using a HP19? The try the new FW:

> **[Homey Pro (2016 — 2019) Changelog](https://homey.app/en-us/wiki/homey-pro-2016-2019-changelog/)**

---

<div class="post-metadata">

**Author:** ![Soeren\_Holm](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/soeren_holm/32/121141_2.png) [@Soeren\_Holm](https://community.homey.app/u/Soeren_Holm)\
**Post date:** [April 1, 2025, 1:31am UTC](https://community.homey.app/t/app-pro-mysql-client/62459/94 "2025-04-01T01:31:48Z")

</div>

Hi, No its a homey pro 2023, but agree it looks like the same problem, will try a full backup/ restore tonight, if not working, I will see if I can install V1.0.4 again 🙂

---

<div class="post-metadata">

**Author:** ![Pat\_M](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/pat_m/32/56295_2.png) [@Pat\_M](https://community.homey.app/u/Pat_M)\
**Post date:** [April 11, 2025, 9:27am UTC](https://community.homey.app/t/app-pro-mysql-client/62459/95 "2025-04-11T09:27:26Z")

</div>

Thank you very much RonnyW (and sorry for late reply, life+longer testing).  
This seem to work very well now. I have ran it for more than a week now, no complaints from my ISP so far.  
Also I have started logging active connections to my MySQL database (Threads\_connected) and I’m monitoring this via variables and Insights. Average is 20 and max was 56 one day. I think the cap is 100.

Thank you again, really appreciate your work so I can have all my database-queries running again!

---

<div class="post-metadata">

**Author:** ![Koen\_Crijns](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/koen_crijns/32/79731_2.png) [@Koen\_Crijns](https://community.homey.app/u/Koen_Crijns)\
**Post date:** [April 28, 2025, 7:55pm UTC](https://community.homey.app/t/app-pro-mysql-client/62459/96 "2025-04-28T19:55:15Z")

</div>

Hi Ronny,

I try to use this app and connect to the MySQL database running on my Synology NAS. When creating the database device, the “Check Connection” button results in a “success” message. When creating the dive I get a “Network request errror”.

Can you see what’s going wrong? I’ve uploaded a debug report with id a3551f36-a5a3-47f2-b212-71733673fc62.

Thanks!

---

<div class="post-metadata">

**Author:** ![RonnyW](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ronnyw/32/10879_2.png) [@RonnyW](https://community.homey.app/u/RonnyW)\
**Post date:** [April 28, 2025, 8:30pm UTC](https://community.homey.app/t/app-pro-mysql-client/62459/97 "2025-04-28T20:30:26Z")

</div>

This is not logged it seems.  
The connection check only checks if the IP and port is accessible.  
The access via flow is creating a real connection incl. user/pw.

Is your port correct? Default is 3306.  
A request error can also be caused by a wrong password (http 403).  
Has the user access to a database (or tables)?

PS:  
The app is reading the list of databases, the user has access to. So perhaps the MySql server responds wirh an error if no database is accessible. Please check the database assignments for your user.

---

<div class="post-metadata">

**Author:** ![RonnyW](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ronnyw/32/10879_2.png) [@RonnyW](https://community.homey.app/u/RonnyW)\
**Post date:** [May 1, 2025, 11:04am UTC](https://community.homey.app/t/app-pro-mysql-client/62459/98 "2025-05-01T11:04:21Z")

</div>

New **live version 1.0.7** :

- Fixes DB request closing issue in **pair view**.

@Koen_Crijns FYI and test. Should work now.

---

<div class="post-metadata">

**Author:** ![Koen\_Crijns](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/koen_crijns/32/79731_2.png) [@Koen\_Crijns](https://community.homey.app/u/Koen_Crijns)\
**Post date:** [May 1, 2025, 8:54pm UTC](https://community.homey.app/t/app-pro-mysql-client/62459/99 "2025-05-01T20:54:37Z")

</div>

It works like a charm now, thanks for the fix! 👍

---

<div class="post-metadata">

**Author:** ![Pat\_M](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/pat_m/32/56295_2.png) [@Pat\_M](https://community.homey.app/u/Pat_M)\
**Post date:** [July 2, 2025, 6:41pm UTC](https://community.homey.app/t/app-pro-mysql-client/62459/100 "2025-07-02T18:41:31Z")

</div>

Hi guys! Quick question, I guess it’s possible to add more than 1 database (device in Homey)? I currently have 1 device in Homey (for 1 specific MySQL database) and I would like to setup another one without deleting the first one in any way.

Thanks!

[Previous page](https://community.homey.app/t/app-pro-mysql-client/62459.md?page=4)

[Next page](https://community.homey.app/t/app-pro-mysql-client/62459.md?page=6)
