Closed LinAGKar closed 3 years ago
Try the following settings for Host/Port:
- MYSQL_HOST=/var/run/mysqld/mysqld.sock
- MYSQL_PORT=
or even fewer
- MYSQL_HOST=/var/run/mysqld/mysqld.sock
I think the combination localhost
and as port a socket doesn't work, it becomes:
localhost:/var/run/mysqld/mysqld.sock
I've tried that to, as well as MYSQL_HOST=/var/run/mysqld/
and MYSQL_HOST=localhost:/var/run/mysqld/mysqld.sock
, and I've tries entering /var/run/mysqld/mysqld.sock
, localhost:/var/run/mysqld/mysqld.sock
and unix:/var/run/mysqld/mysqld.sock
as the database server name in the install wizard.
From what I understand from the source and the documentation, it would need to set unix_socket
in order to specify a custom unix socket path. Otherwise, if you set host to localhost, it will use the default, which depends on what it's compiled against.
If I change pdo_mysql.default_socket
to /var/run/mysqld/mysqld.sock
in /usr/local/etc/php/php.ini-production
, and set the host to localhost, that seems to work. This seems to be the only way.
@annando do you know what Friendica does support for host/port settings? I think there's just a general host config entry, so at least setting just the host should have worked.
When MYSQL_PORT
is given, then it is added to the hostname:
https://github.com/friendica/friendica/blob/develop/src/Database/Database.php#L96-L98
Yes, but even in case it isn't set, it doesn't work. My question is if you know that socket connections per se should work.
This is something I don't know.
Nevermind about php.ini-production
, that does not help. What actually did was symlinking /tmp/mysql.sock to the socket, which I'd done during the troubleshooting earlier. That gets it past the database page in the install wizard, but the automated setup still doesn't work. I still just get:
Waiting for MySQL localhost initialization...
............................................................................................................................................................................................................................................................................................................
[ERROR] Waited 300 seconds, no response
At least I know the answer now. We currently don't support socket connections at all :) - see https://github.com/friendica/friendica/issues/6606
PDO
- We would need the parameter unix_socket
in our DSN to enable this feature (see https://www.php.net/manual/en/ref.pdo-mysql.connection.php ).
https://github.com/friendica/friendica/blob/99a145f7cff984f19e8adbc018a8b631aaa58e0f/src/Database/Database.php#L128-L136
mysqli
- We would need the parameter $socket
at our mysqli()
call (see https://www.php.net/manual/en/mysqli.construct.php ).
https://github.com/friendica/friendica/blob/99a145f7cff984f19e8adbc018a8b631aaa58e0f/src/Database/Database.php#L151-L153
Both are not implemented, so I'm closing this issue now. @LinAGKar feel free to reopen it in case you need further support
I'm running the friendica:stable-fpm container. I've mounted the socket from mariadb into the container on a volume, and set:
if I then go into the container in a shell and install mariadb-client, I can successfully connect to the DBMS with
mariadb -p"`cat "$MYSQL_PASSWORD_FILE"`" -u "$MYSQL_USER" "$MYSQL_DATABASE"
, but the actual friendica server is not able to connect.