Neither the directory 'mysqld nor the mysqld.sock' exist

Hi

I am trying to set up next cloud and the beginning was fun. I used a How To Install Nextcloud Server - Internetpage 'How to install Nextcloud server on Windows 10 - H2S Media (how2shout.com) which was very useful. It was a set-up under Windows 10 pro and Linus WSL

All was ok until step 8 but when entering the command ā€˜sudo mysqlā€™ the message is shown:

berti@DESKTOP-C8OEOD4:/$ sudo mysql
ERROR 2002 (HY000): Canā€™t connect to local server through socket ā€˜/run/mysqld/mysqld.sockā€™ (2)

And after testing if mysqld service is running:

berti@DESKTOP-C8OEOD4:/$ mysqladmin -u root -p status
Enter password:
mysqladmin: connect to server at ā€˜localhostā€™ failed
error: ā€˜Canā€™t connect to local server through socket ā€˜/run/mysqld/mysqld.sockā€™ (2)ā€™
Check that mariadbd is running and that the socket: ā€˜/run/mysqld/mysqld.sockā€™ exists!

I checked mariadb and mysql version:

berti@DESKTOP-C8OEOD4:/$ mysql -u user -p
Enter password:
ERROR 2002 (HY000): Canā€™t connect to local server through socket ā€˜/run/mysqld/mysqld.sockā€™ (2)

berti@DESKTOP-C8OEOD4:/$ dpkg -l | grep -e mysql-server -e mariadb-server
ii mariadb-server 1:10.6.7-2ubuntu1.1 all MariaDB database server (metapackage depending on the latest version)
ii mariadb-server-10.6 1:10.6.7-2ubuntu1.1 amd64 MariaDB database server binaries
ii mariadb-server-core-10.6 1:10.6.7-2ubuntu1.1 amd64 MariaDB database core server files

berti@DESKTOP-C8OEOD4:/$ mysqld --version
mysqld Ver 10.6.7-MariaDB-2ubuntu1.1 for debian-linux-gnu on x86_64 (Ubuntu 22.04)

berti@DESKTOP-C8OEOD4:/$ mysqladmin -V
mysqladmin Ver 9.1 Distrib 10.6.7-MariaDB, for debian-linux-gnu on x86_64

Another try was:

berti@DESKTOP-C8OEOD4:/$ sudo mysqld start
2022-11-18 23:47:46 0 [Note] mysqld (server 10.6.7-MariaDB-2ubuntu1.1) starting as process 148 ā€¦
mysqld: Please consult the Knowledge Base to find out how to run mysqld as root!
2022-11-18 23:47:46 0 [ERROR] Aborting

Neither the directory ā€˜mysqld nor the mysqld.sockā€™ exist. Have you any idea or suggestion what is wrong and what I should do now?
Thanks, Berti

I think you need to make sure that your database is correctly configured first. If youā€™re not entering a hostname or using ā€œlocalhostā€ a socket is usually used to connect to the database. Please check-out the following information. A lot of more can be found by search for the mentioned error message :wink: