Skip to content

Add support for MariaDB/MySQL #283

Open
@Matir

Description

@Matir

Describe the feature request

sqlite and postgres are both available as storage engines. In some environments, where a MySQL or MariaDB server already exists, it would be convenient to use a DB on this server.

Why do you personally want this feature to be implemented?

I have an environment with MySQL/MariaDB :)

How long have you been using this project?

Currently evaluating

Additional information

If there are no known technical blockers why it would not work, I'm happy to take a pass at implementing the support and send a PR. It looks like it should be fairly doable, and would be in the same style as the postgres/sqlite split.

Activity

changed the title [-]MariaDB/MySQL Support[/-] [+]feat(storage): Add support for MariaDB/MySQL[/+] on May 13, 2022
TwiN

TwiN commented on May 13, 2022

@TwiN
Owner

Sounds good to me!

It may be a bit tricky though, because IIRC, mysql/mariadb does not support the following:

  • INSERT INTO ... RETURNING <column_name>
  • INSERT INTO ... ON CONFLICT(...) DO UPDATE
mrmonkington

mrmonkington commented on Sep 27, 2022

@mrmonkington
  • INSERT INTO ... RETURNING <column_name>

Mariadb (not MySQL) has RETURNING since 10.5, though if you just want to get a new primary key back older versions and MySQL have SELECT LAST_INSERT_ID() which operates per session. (i.e. you are guaranteed to get the last new primary key generated on your current session)

  • INSERT INTO ... ON CONFLICT(...) DO UPDATE

MySQL/MariaDB you have two options to do something similar:

REPLACE INTO -> simpler if you just want to overwrite an old row

or

INSERT ... ON DUPLICATE KEY UPDATE -> more flexible if you, e.g. want to increment a counter

HTH!

changed the title [-]feat(storage): Add support for MariaDB/MySQL[/-] [+]Add support for MariaDB/MySQL[/+] on Feb 5, 2023
schealex

schealex commented on Sep 23, 2024

@schealex

any news on this?

TwiN

TwiN commented on Sep 24, 2024

@TwiN
Owner

@schealex I don't have time to personally work on a feature like this right now, but if you or anybody else are interested in trying to implement it, please don't hesitate.

linked a pull request that will close this issue on Feb 14, 2025
devhaozi

devhaozi commented on Feb 23, 2025

@devhaozi

For someone here who want to test gatus with MySQL, you can use this docker image: ihaozi/gatus:latest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/storageRelated to storagefeatureNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @mrmonkington@Matir@schealex@TwiN@devhaozi

      Issue actions

        Add support for MariaDB/MySQL · Issue #283 · TwiN/gatus