My problem started off with me not being able to log in as root any more on my mysql install. I was attempting to run mysql without passwords turned on... but whenever I
This error occurs due to multiple installations of mysql. Run the command:
ps -A|grep mysql
Kill the process by using:
sudo pkill mysql
and then run command:
ps -A|grep mysqld
Also Kill this process by running:
sudo pkill mysqld
Now you are fully set just run the following commands:
service mysql restart
mysql -u root -p
Have very well working mysql again
I just had this problem on Ubuntu 14.10
Turns that mysql-server
was no longer installed (somehow it had been removed) but I couldn't just install it because there were some broken packages and dependency issues/conflicts.
In the end I had to reinstall mysql
sudo apt-get remove mysql-client
sudo apt-get install mysql-server
I think your MySQL server has not started. So start the server using one of the following commands.
#services mysql start
or
#/etc/init.d/mysql start
Try this command,
sudo service mysql start
My solution;
Ubuntu 18.04 (WSL)
/etc/mysql/my.cnf
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/
/etc/mysql/mysql.conf.d/mysqld.cnf
[mysqld]
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
I changed the port. It's worked for me. You can write another port. Example 3355
Temporary Solution
Maybe someone facing this problem. I am using Mysql Workbench on Ubuntu 14 and got this error.
mysqldump: Got error: 2002: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) when trying to connect
Find your socket file by running sudo find / -type s
, in my case it was /run/mysqld/mysqld.sock
So, I just created a link to this file in tmp
directory.
sudo ln -s /var/run/mysqld/mysqld.sock /tmp/mysql.sock