Mysql and mysql. sock are installed in linux.
Recently, When I installed Aphace, mysql, and php in linux, I encountered many problems. The problems encountered when installing apache and php should be simple. I searched Baidu and google to solve them, I encountered a problem when installing mysql for a long time.
I use ubuntu7.0. when I install mysql and run mysqladmin version, there is always an error:
can't connect to local MySQL server through socket 'var/run/mysqld/mysqld.sock'
This almost caused me to crash. I found a lot of solutions on the Internet. There are several solutions:
1. Permission issues
2. Modify the/etc/my. cnf File
3. Upgrade the operating system or mysql
4. Create/var/run/mysqld. sock
I have tried the above methods and the results have not solved the problem. I almost want to give up, but I want to stick to it, it will be able to solve it. I want to send an email to easychen and zoltan. When I want to send an email, I want to change my mind. My idea is: Sincecan't connect to socket '/var/run/mysqld/mysqld.sock'When I connect to the socket, can I add the socket parameter next to it,
That is:mysqladmin version --socket == /tmp/mysql.sock
I'm so glad that something happened that I didn't think of and the problem was solved. Although the problem has been solved, I don't know why. Why is/var/run/mysqld. sock by default? I checked in the my. cnf file that the socket paths in client and mysqld are both/tmp/mysql. sock, And the socket specified during compilation is also/tmp/mysql. sock! I really don't understand this. It seems that I have to find the answer on the Internet! I hope people familiar with the matter will give you more advice.
The following is a separate introduction to the liunx mysql. sock problem.
Error code: Can't connect to local MySQL server through socket '/var/lib/mysql. sock'
Mysql. sock is not in the/var/lib/mysql directory at all. Your own directory is in/tmp/mysql. sock
Therefore, a connection is established.
ln -s /tmp/mysql.sock /var/lib/mysql/mysql.sock
Restart.
Note: ln usage: ln-s source file target file ln command details:
Summary
The above section describes how to install mysql and mysql in linux. sock problems, I hope to help you. If you have any questions, please leave a message for me. The editor will reply to you in time. Thank you very much for your support for the help House website!