# Ignition Edge MySQL

**URL:** <https://forum.inductiveautomation.com/t/ignition-edge-mysql/44119>\
**Category:** Ignition\
**Created:** [March 4, 2021, 8:15pm UTC](https://forum.inductiveautomation.com/t/ignition-edge-mysql/44119 "2021-03-04T20:15:29Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![andytimc](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/andytimc/32/11938_2.png) [@andytimc](https://forum.inductiveautomation.com/u/andytimc)\
**Post date:** [March 4, 2021, 8:15pm UTC](https://forum.inductiveautomation.com/t/ignition-edge-mysql/44119/1 "2021-03-04T20:15:29Z")

</div>

Is there any way for an edge gateway to write to a MySQL database, or for it to have a query tag that read from a MySQL database, either locally or from a central full versioned ignition server?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [March 4, 2021, 8:17pm UTC](https://forum.inductiveautomation.com/t/ignition-edge-mysql/44119/2 "2021-03-04T20:17:31Z")

</div>

If you make the database connection and query tag on the central Ignition gateway and then add it as a remote Tag Provider to the Edge Ignition gateway you’d be able to access the dataset.

---

<div class="post-metadata">

**Author:** ![andytimc](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/andytimc/32/11938_2.png) [@andytimc](https://forum.inductiveautomation.com/u/andytimc)\
**Post date:** [March 4, 2021, 8:19pm UTC](https://forum.inductiveautomation.com/t/ignition-edge-mysql/44119/3 "2021-03-04T20:19:08Z")

</div>

Thanks Kevin, I need it to be able to write a log entry in the same MySQL database though, it sounds like I might need to use full-fledge ignition servers instead of the edge device.

---

<div class="post-metadata">

**Author:** ![witman](https://avatars.discourse-cdn.com/v4/letter/w/d2c977/32.png) [@witman](https://forum.inductiveautomation.com/u/witman)\
**Post date:** [March 4, 2021, 8:22pm UTC](https://forum.inductiveautomation.com/t/ignition-edge-mysql/44119/4 "2021-03-04T20:22:06Z")

</div>

If this would work for what you need, you can also add the Edge gateway as a remote tag provider on your central gateway and read data from it that way.

---

<div class="post-metadata">

**Author:** ![andytimc](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/andytimc/32/11938_2.png) [@andytimc](https://forum.inductiveautomation.com/u/andytimc)\
**Post date:** [March 4, 2021, 9:09pm UTC](https://forum.inductiveautomation.com/t/ignition-edge-mysql/44119/5 "2021-03-04T21:09:38Z")

</div>

Yeah, the main thing I am attempting to do is set up a data entry station for water haulers. They put in their code, identifying data would be read from a MySQL database for display. They load water to their truck and when they are finished the Load data (time, driver, and load amount) would be submitted to a log MySQL table. I would have these remote stations at 10-20 locations all storing back to a main server. Edge was appealing to me because I was hoping to use the store and forward technique so if we had communication issues we wouldn’t lose the load data. I’m going to have to look into other alternatives now, I believe the full version of ignition will be cost prohibitive.

---

<div class="post-metadata">

**Author:** ![witman](https://avatars.discourse-cdn.com/v4/letter/w/d2c977/32.png) [@witman](https://forum.inductiveautomation.com/u/witman)\
**Post date:** [March 4, 2021, 10:45pm UTC](https://forum.inductiveautomation.com/t/ignition-edge-mysql/44119/6 "2021-03-04T22:45:59Z")

</div>

I feel your pain. The full version is hard to justify for small things and that’s [scheduled to get significantly worse May 3rd](https://page.inductiveautomation.com/pricing-updates-2021).

I haven’t used Edge yet, and I’m not sure whether scripting restrictions would allow this without adding the scripting license to it, but something like following might work:

- Central gateway as remote tag provider on Edge provides identifying data for _all_ codes in a dataset or document.
- Edge gateway looks up identifying data from that dataset so it’s quick and hopefully works when offline (might have to cache that data somehow, but I think it’d stay available when remote tag provider is offline–just bad quality).
- Edge gateway logs load in local buffer. This could be an array of dataset tags, or possibly a dataset or document (again, unsure of scripting restrictions and what you need to store).
- Central gateway with Edge gateway as remote tag provider grabs entries from log tag(s) and logs to SQL, then notifies Edge gateway (via remote tag provider) of retrieved logs to flush from buffer.

You’d probably want to add some kind of notification of buffer getting full to avoid data loss if the connection remains down for some time.
