Install using mysql/mariadb via unix socket

Self-explanatory. I’m trying to install writefreely using a MariaDB backend which is available via unix socket and not via localhost:3306, and the setup script gives me this error:

ERROR: 2020/07/23 22:44:22 app.go:866: dial tcp: lookup /var/run/mysql/mysql.sock: no such host

…which makes sense. I tried generating a blank config.ini but i assume the filename parameter is for SQLite.

Does writefreely support connecting to MariaDB via unix sockets and if so how?

What have you got in config file?

Should be something like this:

[database]
type     = mysql
filename =
username = databaseusername
password = databasepassword
database = databasename
host     = localhost
port     = 3306

Yup, that’s about right.

So… no, it doesn’t support unix sockets?

I found the code where Writefreely opens a connection with Database. Since it uses a DSN template with TCP in it. So, I don’t think it supports using unix socket directly.
https://github.com/writeas/writefreely/blob/4c5f45f4627218ec548d2cc553b89a42042bedd4/app.go#L756

1 Like