PDA

View Full Version : Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)



Wh4t3v3r
2022-01-12, 06:58
Mysql command doesn't work. When I check it via
systemctl status mysql it says "active(exited)". I did try to create new socket like

mkdir /var/run/mysqld
mkfifo /var/run/mysqld/mysqld.sock
chown -R mysql /var/run/mysqld/
service mysql restart


The only difference is the error ends with mysqld.sock' (111) instead of mysqld.sock' (2)

I also tried to do similar thing in /run/mysqld/mysqld.sock and putting in my.cnf file socket = /var/run/mysqld/mysqld.sock instead of socket = /run/mysqld/mysqld.sock
Idk what else I can do..

upd: I discovered that socket path is taken from /etc/mysql/mariadb.conf.d/50-client.cnf, not my.cnf. Nonetheless, changes don't help, perhaps it's not even related...

Wh4t3v3r
2022-01-14, 06:20
Finally I resolved it by installing mysql-server under non-root user (although I used to try it earlier for root one and for whatever reason some problem cropped up; some security restrictions, I guess)