Can't find mysqld.sock: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2 "No such file or directory")

Viewed 6159

I've just registered to Stack Overflow because I really can't get out of this problem since 2 days ago. I use Xampp.

So, I'm following this Laravel tutorial and when from the terminal I type in the project directory or every elsewhere directory mysql or mysql -uroot -p it gives me this error:

Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2 "No such file or directory")

I have mariadb that I've installed from https://mariadb.org/

My OS is Ubuntu 16.04 LTS ( here I typed lsb_release -a ) No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 16.04.2 LTS Release: 16.04 Codename: xenial

By doing cd /var/run/ and then ll I discovered that the directory /var/run/mysqld doesn't exist, and the mysql.sock file neither.

So I googled a bit and I found this where they talk about the /etc/my.cnf file but I discovered by doing some cd commands that I don't have even this file. ( But I've just noticed that I have a /etc/mysql/my.cnf and /etc/mysql/my.cnf.fallback file )

Anithing else ? Oh, yes. Uninstalling mariadb and installing mysql would not resolve the problem because I have issues with the dpkg packages.

I also tried a lot of times installing and uninstalling xamp, laravel dir, mysql, mariadb...

I don't really know what to do. :(((

1 Answers
Related