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

milli727 picture milli727 · Jan 27, 2020 · Viewed 7.7k times · Source

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


Answer

Hansie picture Hansie · Mar 4, 2020
systemctl stop mysql
systemctl stop mariadb
chkconfig --del mysql
systemctl disable mysql
systemctl disable mariadb
systemctl enable mariadb.service
systemctl start mariadb.service