Unable to start MySQL - 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).

Related

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

I have started mysql using
brew services start mysql
and I made sure that mysql is started by checking it using
brew services list
it shows that the status of mysql is "started".
however when I try to run the command
mysql
it'll say:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/mysql/mysql.sock' (62)
I have searched online for multiple answers already but none of them would solve my problem.
How should I solve this?
in my mac, run this will solve my problems
$ sudo mysql.server start

MySQL not working after reboot

I'm using Linux and I recently downgraded MySQL to 5.6 from 5.7 (due to some issues because of its strictness). Now when I use command mysql, I get the error:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
I have checked several posts and systemctl mysql startseems to work. But everytime I reboot my system, I have to use systemctl mysql start again to start MySQL.
Also, service start mysql doesn't work.
There is no /etc/my.cnf file, only /etc/mysql/my.cnf file. I'm using Ubuntu 16.04.
How can I configure it so that the MySQL service starts at boot?
Edit:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
This post is unable to help either.
Basically, if mysql command is running without a host, it looks for a socket file on your local machine (this lets it connect to the running process directly). You have two workarounds. One is to include host in your mysql connection command mysql -u root -p -H 127.0.0.1, the other is to modify my.cnf to include:
[mysqld]
socket=/var/run/mysqld/mysqld.sock
[client]
socket=/var/run/mysqld/mysqld.sock
see here for more.

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.

Connection to database failed! Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

Hello i been running into this error after moving my website to a new host
[DonationSystem] Connection to database failed! Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
I am running on the same version of linux ub 12.04 the server one.
i have a few databases running that are working such as my phpbb one.
i have tried link them edit configs and everything else the internet has told me even removed mysql and reinstalled it so any ideas?
oh and the database is local and im using localhost and root is the user

missing mysql.sock after new install

I recently upgraded to a new macbook pro and haven't been able to get mysql to install. I have been trying to install using the:
mysql-5.5.8-osx10.6-x86_64.dmg
which 'should' work for my machine, but is not. After installing the three pieces (mysql.pkg,
startup.pkg, prefpane) I get nothing. Trying to start mySQL through the prefpane freezes sysprefs. Trying to start via the terminal gets this error:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
So I deleted all of the mysql install files and reinstalled following these instructions:
https://discussions.apple.com/message/12820394
when I get to the step where I would set up the root password i get the following error:
error: 'Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/tmp/mysql.sock' exists!
This is perhaps due to the fact that there are no mysql related files in /tmp ? I can't find anything *.sock anywhere on my machine at all. I really don't know much about server admin, so I could be totally confused and off here.
It can have moved to /var/mysql/mysql.sock. I think it is the new position. You may need to point your php.ini to that or create a symbolic link to ln -s /var/mysql/mysql.sock /tmp/mysql.sock...