ERROR 2002 (HY000): Can\'t connect to local MySQL server through socket \'/var/run/mysqld/mysqld.sock\' (2)
I tried everything I found o
If you have multiple mysql servers installed then make sure you run the correct MYSQL or change your path settings. For example:
/opt/lampp/bin/mysql -u root -p
I have XAMPP installed , the solution worked for me.
It looks like either it can't create a file in /var/lib/mysql/. If you look at the errode 13, it is generally means permission errors.
1) Make sure that mySQL can write to the directory /var/lib/mysql and/or that mySQL owns that directory. Do a:
cd /var/lib ; ls -la | grep mysql
To be sure.
2) If you are trying to start with the mySQL user, start it with root instead (You probably are, but it's worth checking).
3) If you are running something like SElinux, make sure that you enable it for mySQL access. I doubt that is the case, but it's worth checking.
4) Small note: Don't create the sock file - mysql will create one once it is up and running properly. If it still in the run directory, delete it.
Try to kill the socket with (this may depend on your OS)
rm /var/lib/mysql/mysql.sock rm: remove socket `/var/lib/mysql/mysql.sock'? y restart the service
service mysqld start
Your log actually tells you the issue:
mysqld: Too many arguments (first extra is 'start').
Just start the daemon without the word 'start'. Instead of:
sudo /usr/sbin/mysqld start
it should be just:
sudo /usr/sbin/mysqld
I did experiments and finally solve it with these commands
sudo chown mysql:root /var/lib/mysql/ -R
sudo chmod g+rw /var/lib/mysql/ -R
sudo /usr/sbin/mysqld --skip-grant &
It get running...... Hurraaahhhhhhhhhh!!!!!!!!!!!!
Have you tried?
sudo touch /etc/apparmor.d/local/usr.sbin.mysqld
More background info here: https://askubuntu.com/a/127029