Skip to content

Add support for MariaDB/MySQL #283

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Matir opened this issue May 10, 2022 · 5 comments · May be fixed by #1003
Open

Add support for MariaDB/MySQL #283

Matir opened this issue May 10, 2022 · 5 comments · May be fixed by #1003
Labels
area/storage Related to storage feature New feature or request

Comments

@Matir
Copy link

Matir commented May 10, 2022

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.

@TwiN TwiN changed the title MariaDB/MySQL Support feat(storage): Add support for MariaDB/MySQL May 13, 2022
@TwiN TwiN added feature New feature or request area/storage Related to storage labels May 13, 2022
@TwiN
Copy link
Owner

TwiN commented May 13, 2022

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
Copy link

  • 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!

@TwiN TwiN changed the title feat(storage): Add support for MariaDB/MySQL Add support for MariaDB/MySQL Feb 5, 2023
@schealex
Copy link

any news on this?

@TwiN
Copy link
Owner

TwiN commented Sep 24, 2024

@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.

@devhaozi devhaozi linked a pull request Feb 14, 2025 that will close this issue
2 tasks
@devhaozi
Copy link

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
Labels
area/storage Related to storage feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants