MySQL stop/waiting issues; “can't connect … through socket”
check in your nano /etc/mysql/my.cnf
open the file .
Search for bind-address
in file if it is localhost
or 127.0.0.1
than you should be able to login but if it is something other than localhost
than you have to give host to your mysql command mysql -uroot -h xxx.xxx.xxx.xxx -p
Related videos on Youtube
![mfg](https://i.stack.imgur.com/LY3kx.jpg?s=256&g=1)
mfg
I have worked in both first & third-party fulfillment/supply-chain operations roles, web site & app project management, and state government. I have been responsible for maintaining day-to-day efficiencies, providing business intel reporting for cross-departmental decision making, and creating or revising business practices to standardize performance and results. I have had the opportunity to work closely with a wide range of stakeholders and voices, both internal and external, to deliver on web site development, CRM utilization, internal product development, merchant support, and compliance analysis. I have relied on listening to their needs to shape collaborative, workable solutions that solve problems and get answers. All this experience led - unavoidably - to one thing: I really enjoy cooking for people with difficult dietary specifications or who are just picky eaters.
Updated on September 18, 2022Comments
-
mfg almost 2 years
So this was my first time putting up a LAMP stack on a Bodhi machine (previously experience with WAMP, and LAMP on 10.04); I got Apache going, and a Drupal install begun, then I go to create a new database and when I log in to phpmyadmin ... I get a 'cannot connect error'. Tracing this back, the issue began once I tried to get virtual hosts up and running in Apache; once that was done I started running into socket connection issues with mysql.
Initially the problem looked like this:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
Using
ls -lart /var/run/my*
I get this:total 0 drwxr-xr-x 2 mysql root 40 Jan 31 11:56 . drwxr-xr-x 21 root root 740 Jan 31 12:21 ..`
I ran
touch /var/run/mysqld/mysqld.sock
and setchown -R mysql /var/run/mysqld
which allows for:total 0 drwxr-xr-x 21 root root 740 Jan 31 12:21 .. -rw-r--r-- 1 mysql root 0 Jan 31 13:58 mysqld.sock drwxr-xr-x 2 mysql root 60 Jan 31 13:58 .
- So when I try to run
mysql -u root -p
I get one error -ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (13)
(note it is no longer ERROR 2002...(2) but rather ERROR 2002...(13)) - If I try
service mysql restart
(or stop, start) I get another error -start: Rejected send message, 1 matched rules; type="method_call", sender=":1.49" (uid=1000 pid=8407 comm="start mysql ") interface="com.ubuntu.Upstart0_6.Job" member="Start" error name="(unset)" requested_reply="0" destination="com.ubuntu.Upstart" (uid=0 pid=1 comm="/sbin/init")
- When I run
sudo service mysql restart
I getstop: Unknown instance: start: Job failed to start
- When I run
service mysql status
I get "mysql stop/waiting"
What can I do to diagnose the issues I am having with mysql? I may be overlooking an utterly simple mysql issue and would appreciate any feedback on what I've done so far.
Also, being a Bodhi machine and most of the instruction/feedback being written for Ubuntu, I am unsure to what extent any Ubuntu instruction may not apply. In particular, am I running into a problem related to the difference between
/etc/init.d/...
andservice ... ...
commands? Or, perhaps, am I running into a difference between libraries of the two?-
Dimitre Radoulov over 11 yearsPlease post the content of the MySQL error log.
- So when I try to run