Installation of mysql and mysql.sock under linux
Recently, when installing Aphace,mysql,php on linux, I encountered a lot of problems. The problems encountered in installing apache and php should be simpler. In Baidu and google, it was solved with a search. Only when installing mysql, I encountered a problem that perplexed me for a long time.
I use ubuntu7.0. When I install mysql, I always make an error when I run mysqladmin version:
Can't connect to local MySQL server through socket 'var/run/mysqld/mysqld.sock'
This makes me almost collapse, I have found a lot of solutions on the Internet, there are probably several solutions:
1. Authority problem
two。 Modify / etc/my.cnf file
3. Operating system or mysql upgrade
4. Create / var/run/mysqld/mysqld.sock
I have tried all the above methods, but none of them solved the problem. I'm about to give up, but I want to hold on a little longer. I'm sure I can solve it. I'm going to send an email to easychen,zoltan. When I'm about to send an email, I wonder if I can change my mind. My idea is: since can't connect to socket'/ var/run/mysqld/mysqld.sock', then when I link to socket, don't I just add the socket parameter at the end?
That is: mysqladmin version-- socket = = / tmp/mysql.sock
I am so glad that the problem has been solved when something unexpected has happened. The problem is solved, but I don't know why, why the default is / var/run/mysqld / mysqld.sock? I checked in the my.cnf file and found that the socket path in both client and mysqld is / tmp/mysql.sock, and the socket specified at compile time is also / tmp/mysql.sock! I really don't understand this point. It seems that I need to look for answers on the Internet. I look forward to more advice from people with knowledge of the matter.
Next, I would like to introduce the liunx mysql.sock problem to you separately.
Error code: Can't connect to local MySQL server through socket'/ var/lib/mysql/mysql.sock'
Mysql.sock is not even in the / var/lib/mysql directory. Your own directory is in / tmp/mysql.sock
So I made a connection.
Ln-s / tmp/mysql.sock / var/lib/mysql/mysql.sock
Just restart it.
Note: ln usage: ln-s source file target file ln command details:
Summary
The above is the problem of installing mysql and mysql.sock under linux introduced by the editor. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply you in time. Thank you very much for your support to the website!