Can’t connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'

Hello,
I was playing around with docker, and suddenly, I got a 500 error on accessing my CyberPanel.
I have Ubuntu 20.04.4 LTS

When trying to access the panel, I see 500 error.
So I did nano /usr/local/CyberCP/CyberCP/settings.py and enabled debug True.
Then I did systemctl restart lscpd and now I see following error:

Exception Value: (2002, “Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)”)

I tried sudo service mysql start but I get

Job for mariadb.service failed because the control process exited with error code.
See “systemctl status mariadb.service” and “journalctl -xe” for details.

So I did systemctl status mariadb.service and now I get :

mariadb.service: Main process exited, code=exited, status=1/FAILURE
mariadb.service: Failed with result ‘exit-code’.
Failed to start MariaDB 10.3.34 database server.

If I do df, no file system is above 50% usage.

If I do sudo journalctl -xe, I see :

pdns.service: Main process exited, code=exited, status=1/FAILURE
pdns.service: Failed with result ‘exit-code’.

I removed all docker containers with docker rm $(docker ps -aq)

If i try mysqladmin -u root -p status, it gives me :

error: ‘Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)’
Check that mysqld is running and that the socket: ‘/var/run/mysqld/mysqld.sock’ exists!

By the way, even doing an upgrade of Cyberpanel gives me same above error at the end.
I used this command to try to upgrade:
sudo su - -c "sh <(curl https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/preUpgrade.sh || wget -O - https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/preUpgrade.sh)"

If I do netstat -lnp | grep 8090, I see

tcp 0 0 0.0.0.0:8090 0.0.0.0:* LISTEN 20314/lscpd (lscpd

If i do sudo find / -type s, I don’t see any result with mysql* sock… (not sure if normal?)

I did ls -ld /var/lib/mysql, which gave me:

drwxrwxrwx 5 docker docker 4096 Jun 10 11:20 /var/lib/mysql

So now I am not sure to what should I change that, because I don’t think it should be “docker”!
I tried root:root and mysql:mysql, but didnt solve it…

If i do sudo systemctl enable mysql, I get

Synchronizing state of mysql.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable mysql
Failed to enable unit: Refusing to operate on alias name or linked unit file: mysql.service

I tried sudo reboot, but still the same.

So I have no idea what to do now, nor how/why it happened.

Can anyone please help ?

so it seems that when I setup the docker, I mapped /var to /srv/var, and somehow, all the chown of /var are now to docker…so I am not sure how to solve that…looks like it’s all messed up now and that I have to reinstall it all…

df command out put?

sshots02988

(note that the two /snaps are new as I tried something else since then, and I just unmounted them)

and somehow, I really think the issue is linked with fact that when I tried installing the docker via Cyberpanel, in the “map volumes” area I put “/var → /srv/var” which I think changed all the ownership of /var to docker…and broke it all …and now of course, I don’t know how to revert the ownership to what it should be. unless you tell me it has no impact

btw, this is the compose yml of the docker I wish to install, this is why i did the mapping /var to /srv/var :slight_smile: remark42/docker-compose.yml at master · umputun/remark42 · GitHub
let me know if it should have been something else…

what is the output of df -i

sshots03009
here you go