MYSQL databases refusing to be accesed after reboot - mysql

Every time I reboot my computer and try to access my mysql database it produces the following error:
ERROR 2002 (HY000):
Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
any ideas on how to resolve this?

It might be that your MySQL is not started automatically on system start-up. Kindly execute mysqld to start the MySQL.
Or please refer https://askubuntu.com/questions/416309/start-mysql-on-startup, to start MySQL on system start-up, assuming that you are on Linux OS.

Related

mysql ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

I have mysql database which was working fine earlier. After getting too many connections error. I have increased max connection and restarted my centos server. But after restart I used below command to connect to server.
mysql -uroot -p
But I am getting below errors.
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2).
I tried all the options available on google. But it didn't worked for me. Some are saying to reinstall mysql, but I have data in GB's which I don't want to lost. Please can anyone help me to solve this problem.Thanks in advance.
Make sure you are indexing the right socket file.
Try this and provide the output.
check the socket in the my.cnf
cat /etc/my.cnf | grep -i socket

After system update getting error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'

error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
I have been tried most off solutions given for above error but i am not able to connect mysql server. It had been working before my ubuntu system update.
I found the problem, The mysql library update stucks. That is why mysql server updating process not be completing.
When i check command "ps aux | grep mysql", i got process list of mysql update stuck processing as in given below image
click here to show image
So, when i killed those both processes(pid=6728 and 7041), I am able to connect mysql server easily.

Unable to start MySQL

I am using a virtual machine (ubuntu12.04) with Vagrant for development purposes. I had installed Apache, PHP and MySQL - which all originally worked. Now, MySQL seems to not work.
When I check the stasus by using sudo service mysql status:
mysql stop/waiting.
I tried to restart MySQL:
stop: Unknown instance
start: Job failed to start
While trying to connect via mysql -u root -p:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket
'/var/run/mysqld/mysqld.sock' (111)
I have gone through different questions related to this issue on this site but most solutions are referring to a memory space problem (which is not in my case).

Issue when starting MySQL on Mac OSX

I downloaded Mac OSX MySQL Community edition (http://dev.mysql.com/downloads/mysql/), and when I start it at
/usr/local/mysql/bin/mysql
I meet with the following issue:
ERROR 2002 (HY000):
Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
Anyone have any good ideas? Thanks in advance.
Meeting with new issues cannot connect to local MySQL instance using MySQL WorkBench, here are my setup and error, looks access denied and anyone have any ideas?
Most likely the service isn't running or it's looking for the socket in the wrong path.
The /usr/local/mysql/bin/mysql call you made is actually the client, not the server/service.
There should be a mysql_safe executable in that same directory -- try calling that first (you may have to be root).
sudo /usr/local/mysql/bin/mysqld_safe

MySql ERROR 2002

i have install mysql in my server {ubuntu 12.04 LTS} and it's work great
but now all my database is down and when i run in termeanl {mysql} it's give this error
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111)
and when i try to start mysql it's give that error {service mysqld start}
mysqld: unrecognized service
i dont need to lose my data so i dont make anything in the server, can you please help me?
As i menthoid here, there are many ways to rome. I did mention apache, but as you figured out, the correct term was mysqld.
So instead of the command start mysql, you can also use /etc/init.d/mysqld start.
There are lots and lots of links for troubleshooting this error. For example:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'
In your case "111" is connect error - you simply don't have the mySql server running.
So the real problem is getting "service mysqld start" to work.
Suggestion: try reinstalling:
https://serverfault.com/questions/361614/mysqld-unrecognized-service
http://www.linuxquestions.org/questions/linux-software-2/mysqld-unrecognized-service-4175432133/