I installed LAMP on Ubuntu 12.04 LTS (Precise Pangolin) and then set root password on phpMyAdmin. I forgot the password and now I am unable to login. When I try to change password through terminal I get:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
How can I fix this? I am unable to open LAMP, uninstall it or reinstall it.
Try this:
Also (to see if it's running):
Probably it is just a misconfiguration in the
my.cnf
file, in/etc/somewhere
(depending on the Linux distribution).In my case it was that the disk was full and mysqld couldn't start anymore.
Try to restart mysql service.
or
If it doesn't recognize "stop" command then it's definitely the disk space. You should make some space in the partition mysql is allocated or make the disk larger.
Check the disk space with
I just experienced the same issue after I had to restart my production server. I am running Debian 8.1 (Jessie) on a DigitalOcean droplet.
This is what I did to resolve my issue:
Check if the file
/var/run/mysqld/mysqld.sock
exists. If it doesn't, manually create it by enteringtouch /var/run/mysqld/mysqld.sock
(which is what I had to do).So the MySQL process can use this file. Change ownership of said file by entering
chown mysql /var/run/mysqld/mysqld.sock
.Once '2' has been done, restart the MySQL service by entering
service mysql restart
or/etc/init.d/mysql restart
.After going through the above steps, my issue was solved. I rarely have this issue, and there is probably a better way, so by all means provide constructive feedback if need be :).
Your mysql-server might not be running. Ensure it runs by typing
mysql.server start
into the terminal.Here's what worked for me:
This creates a link.
If you're using Amazon EC2, and you're having this problem on the instance, then you only need to do:
Amazon EC2 doesn't have a server installed (only the client is installed), so in case of that you need to install that on your instance, and after that try
to check if that worked.