5

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. :(((

Mydevlab2799
  • 96
  • 1
  • 8
  • What is in /var/log/mysql/error.log or /var/log/mariadb/error.log? – Elvis Plesky Jul 24 '17 at 02:00
  • @ElvisPlesky I don't know where to start from, there are thousands of raws. Maybe this(?): Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key [Note] Server hostname (bind-address): '127.0.0.1'; port: 3306 [Note] - '127.0.0.1' resolves to '127.0.0.1'; Server socket created on IP: '127.0.0.1'. Can't start server: Bind on TCP/IP port: Address already in use Do you already have another mysqld server running on port: 3306 ? Aborting **It seems that it gives error only until 23jul even if I typed mysql today too** – Mydevlab2799 Jul 24 '17 at 09:53
  • 1
    So here is the reason. Something else listens on port 3306. Find what with netstat -ntpl | grep 3306 – Elvis Plesky Jul 24 '17 at 14:06
  • **alessio@E1-510:/opt/lampp$ sudo netstat -ntpl | grep 3306** [sudo] password di alessio: **tcp6 0 0 :::3306 :::* LISTEN 17999/mysqld** – Mydevlab2799 Jul 24 '17 at 15:42
  • I don't think that's the problem. However I still can't undertstand why I miss that two files ( **/etc/my.cnf** and **/var/run/mysqld/mysqld.sock** ) and even if I want to create them from myself, I don't know what should I write inside them. – Mydevlab2799 Jul 24 '17 at 15:45

1 Answers1

3

I got it! So, first I removed every trace of MariaDB with these commands:

sudo service mysql stop
sudo apt-get --purge remove "mysql*
sudo rm -rf /etc/mysql/ 

Then I reinstalled it:

apt-get update
apt-get upgrade
apt-get install mariadb-server

Now mariaDB works. However I still have problems with xampp because his Mysql database has a conflict with my mariaDB. So I changed the Xampp Mysql port from 3306 to 3308 and all works fine.

Mydevlab2799
  • 96
  • 1
  • 8