I am getting the following error when I try to connect to mysql:
Can\'t connect to local MySQL server through socket \'/var/lib/mysql/mysql.sock\' (2)
<
First enter "service mysqld start" and login
In my case, I was importing a new database, and I wasnt able to connect again after that. Finally I realized that was a space problem.
So you can delete the last database and expand you hard drive or what I did, restored a snapshot of my virtual machine.
Just in case someone thinks that is useful
MariaDB, a community developed fork of MySQL, has become the default implementation of MySQL in many distributions.
So first you should start,
$ sudo systemctl start mariadb
If this fails rather try,
$ sudo systemctl start mysqld
Then to start mysql,
$ mysql -u root -p
As of today, in Fedora the package is named mariadb
And in Ubuntu it is called mariadb-server
.
So you may have to install it if its not already installed in your system.
Ensure that your mysql service is running
service mysqld start
Then, try the one of the following following:
(if you have not set password for mysql)
mysql -u root
if you have set password already
mysql -u root -p
I had to disable explicit_defaults_for_timestamp
from my.cnf.
Please check whether another mysql service is running.