How to connect to database with a socket

Hi!
This looks promising and I’m trying to manually install it in ArchLinux. I use mysql with sockets and I cannot find how to set the path in config.yml. This is one of my attempts and the error I usually get

# Database host
  host: "unix:/run/mysqld/mysqld.sock"
CRITICAL	▶ migration/Migrate 002 Migration failed: dial tcp: address tcp//run/mysqld/mysqld.sock: unknown port

Looks like we always assume a tcp connection. Fix is up: #1497 - fix: using mysql via a socket - api - Gitea

The changes in the PR assume a unix socket host would always start with /, similar to how we handle this for postgres connections.

Fix is now merged, please check with the next unstable build (~45min) if you’re able to set it up with mysql via a unix socket.

Please note in your config you’ll need to set this to host: /run/mysqld/mysqld.sock (without the unix:/ prefix).

I just tried and with the correct host, and it still gives me the following error

Could not connect to db: default addr for network '/run/mysqld/mysqld.sock' unknown

Permissions are correct and no extra logs from vikunja.

Does it work if you specify the address as unix(/run/mysqld/mysqld.sock)?

Similar issue

Migration failed: dial tcp: lookup unix(/run/mysqld/mysqld.sock): no such host

I’ve just pushed another fix for this in 7ad256f6cd. Can you check again with the last unstable build?

Working! thanks for the quick fixes! ^^

Using config file: /usr/local/share/webapps/vikunja/config.yml
2023-04-17T21:18:46.265837223+02:00: INFO	▶ migration/Migrate 050 Ran all migrations successfully.
2023-04-17T21:18:46.265936249+02:00: INFO	▶ models/RegisterReminderCron 051 Mailer is disabled, not sending reminders per mail
2023-04-17T21:18:46.266013855+02:00: INFO	▶ models/RegisterOverdueReminderCron 052 Mailer is disabled, not sending overdue per mail
2023-04-17T21:18:46.266130644+02:00: INFO	▶ cmd/func25 053 Vikunja version v0.20.4+95-7ad256f6cd
⇨ http server started on /run/vikunja/vikunja.sock
1 Like