Debian 10 MariaDB 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
Asked Answered
S

2

7

Good evening Community,

I am in despair because I cannot install MariaDB on Debian10. There are similar Stackoverflow questions but none of them helped to solve my problem.

What I've tried:

$ sudo apt update
$ sudo apt install mariadb-server

So far no errors.

$ sudo mysql_secure_installation

Leads to:

Enter current password for root (enter for none): ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
systemmd errors

Searching for the file called "mysqld.sock" doesn't deliver results.

$ cd /etc/init.d/
$ mysqld_safe
$ sudo find / -type s | grep mysqld.sock

Doesn't deliver any results. It appears that no mysqld.sock file has been created.

Stackoverflow: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

Can anybody please help me with this problem?

Thanks,

milli727


Sericin answered 27/1, 2020 at 16:16 Comment(5)
Check if the server is already running $ sudo systemctl status mariadb if not check the logs first.Paving
@Paving "System has not been booted with systemd as init system (PID 1). Can't operate."Cymric
@Cymric docker? see #59466750Paving
@Paving Nope, WSL.Cymric
aha, see #52197746Paving
M
0

Not a Linux expert, but learning every day. Had the same thing, installed Mariadb yesterday on a new Debian server. That's what brought me to this question.

First:

sudo systemctl status mariadb

You will probably find red flags there, and most probably the mariadb service is not running.

sudo systemctl restart mariadb

And again:

sudo systemctl status mariadb

to test if it runs now.

And IMPORTANT don't forget to enable the service so that the mariadb service will automatically restart after a restart of the server.

sudo systemctl enable mariadb

Hope that helps.

Musso answered 17/1 at 10:7 Comment(0)
D
-1
systemctl stop mysql
systemctl stop mariadb
chkconfig --del mysql
systemctl disable mysql
systemctl disable mariadb
systemctl enable mariadb.service
systemctl start mariadb.service
Discrepant answered 4/3, 2020 at 5:59 Comment(1)
This is a very elaborate response, which neither works nor contains available commands.Sabah

© 2022 - 2024 — McMap. All rights reserved.