Can't initialize NextCloud. It won't connect to MySQL. Error: SQLSTATE[HY000] [2002] No such file or directory

Hello,
I’m trying to initialize NextCloud, but NC can’t seem to connect to the MySQL DB.

I get this error on the initialization page:

Error while trying to create admin user: Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [2002] No such file or directory

I’ve tried to re-install NC via the CLI with nextcloud_install, following the instructions to delete the config.php file, drop the nextcloud DB, and drop the nextcloud@localhost and nextcloud@127.0.0.1 users.

I have tried miska’s solution in a similar thread. Miska writes:

There is also /srv/mysql that has to has correct owner - mysql:mysql. I think we might be running webserver as nobody - try that one for the Nextcloud directory.

This solution also doesn’t seem to resolve my particular issue.

As a side note, I can connect to MySQL via mysql -u root, so the service is running.

Another important detail: I had previously installed NC on my device, and it worked perfectly fine. However, I made the mistake of installing NC it before initializing my external storage. I then rolled my device back to an earlier snapshot so I could set up my external storage and install NC in the proper order. It was after this that I began experiencing this issue.

Any help on this issue would be greatly appreciated!

Additional info:

Device: Omnia
TurrisOS version: 6.2.3
NextCloud Data folder location: /srv/www/nextcloud/data.
MariaDB server version: 10.4.26

NextCloud-related packages installed on device:

Package Name Version
nextcloud 23.0.11-2
nextcloud-install 23.0.11-2
foris-controller-nextcloud-module 0.2.0-3.9-1
reforis-nextcloud-plugin 0.1.0-3.9-1
turris-webapps-nextcloud 1.0-6

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.