Support Unix socket connections for MySQL/MariaDB#3845
Draft
Copilot wants to merge 3 commits into
Draft
Conversation
Agent-Logs-Url: https://github.com/semaphoreui/semaphore/sessions/a735f9b5-6b81-49e1-851e-41d60e56f8a9 Co-authored-by: fiftin <914224+fiftin@users.noreply.github.com>
Agent-Logs-Url: https://github.com/semaphoreui/semaphore/sessions/a735f9b5-6b81-49e1-851e-41d60e56f8a9 Co-authored-by: fiftin <914224+fiftin@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add support for socket connection to MariaDB
Support Unix socket connections for MySQL/MariaDB
May 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The MySQL connection string builder always wrapped the host in
tcp(...), making it impossible to connect via Unix socket as supported by the Go MySQL driver.Changes
util/config.go: AddedmysqlHasNetworkPrefixhelper that detects known MySQL driver protocol prefixes (tcp,tcp4,tcp6,unix,pipe).GetConnectionStringnow passes the host as-is when a prefix is already present, otherwise falls back to the existingtcp(...)wrapping.util/config_test.go: AddedTestMySQLGetConnectionStringcovering both TCP and Unix socket host formats.Usage
In
semaphore.json, specify the socket path using the Go MySQL driver's native syntax:{ "mysql": { "host": "unix(/var/run/mysqld/mysqld.sock)", "user": "semaphore", "pass": "password", "name": "semaphore" } }