can't open mysql

I've had this server running for years but suddenly i get the error

'/var/run/mysqld/mysqld.sock' (2)

when I try to run my website which accesses the mysql server.

If I log into the server and try to log in to msqyl, I get a similar error.


web:~# mysql -u root
ERROR 2002: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
web:~#


I tried to locate a socket that was open, but the mysql did not appear to be open:
/var/spool/postfix/private/rewrite
/var/spool/postfix/private/bounce
/var/spool/postfix/private/defer
/var/spool/postfix/private/trace
/var/spool/postfix/private/verify
/var/spool/postfix/private/proxymap
/var/spool/postfix/private/smtp
/var/spool/postfix/private/relay
/var/spool/postfix/private/error
/var/spool/postfix/private/local
/var/spool/postfix/private/virtual
/var/spool/postfix/private/lmtp
/var/spool/postfix/private/anvil
/var/spool/postfix/private/maildrop
/var/spool/postfix/private/uucp
/var/spool/postfix/private/ifmail
/var/spool/postfix/private/bsmtp
/var/spool/postfix/private/scalemail-backend
/var/spool/postfix/public/cleanup
/var/spool/postfix/public/flush
/var/spool/postfix/public/showq
/dev/log
/dev/printer


THEN i tried to see if mysql was running and to start it:
web:~# ps aux | grep mysqlps aux | grep mysql
grep: aux: No such file or directory
web:~# /etc/init.d/mysql start
Starting MySQL database server: mysqld...failed.
        Please take a look at the syslog.
/usr/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!


I have no idea where to go now ...

thanks in advance.
kennethmurrahAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dan CraciunIT ConsultantCommented:
rm /var/run/mysqld/mysqld.sock
/etc/init.d/mysql start

Open in new window


Explanation: when Mysql crashes, it does not delete the mysqld.sock file. Then, when you try to start it, it sees that the file exists and assumes there is another instance opened.
Just remove myqld.sock and you'll be able to start the daemon.

HTH,
Dan
0
kennethmurrahAuthor Commented:
Dan,

I tried that, but it resulted in the following error message:

web:/etc/mysql# rm /var/run/mysqld/mysqld.sock
rm: cannot remove `/var/run/mysqld/mysqld.sock': No such file or directory
0
Dan CraciunIT ConsultantCommented:
OK.
What's happens if you run
/etc/init.d/mysqld_safe
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Manfred BertlManagerCommented:
Maybe your MySQL-Server creates the socket file somewhere different? (like /tmp)
0
kennethmurrahAuthor Commented:
No, that's the right place for it. I confirmed that in my.cnf
0
Dan CraciunIT ConsultantCommented:
Have you tried mysqld_safe? If it's not in /etc/init.d then find it's location with
which mysqld_safe
0
kennethmurrahAuthor Commented:
I found the problem. There was an incorrect bind_address in my.conf.

Thanks to all
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
MySQL Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.