Installing mysql and mysql. sock under linux

  • 2021-10-11 19:53:57
  • OfStack

Recently, when installing Aphace, mysql and php on linux, I encountered many problems. The problems encountered in installing apache and php were simpler, which were solved by searching on Baidu and google, but I encountered one problem when installing mysql, which bothered me for a long time.

I am using ubuntu 7.0. When I install mysql, I always have an error running mysqladmin version:


 can't connect to local MySQL server through socket 'var/run/mysqld/mysqld.sock'

This made me almost collapse. I searched many solutions on the Internet. There are probably several solutions:

1. Authority issues

2. Modifications to document /etc/my. cnf

3. Operating system or mysql upgrade

4. Creat/var/run/mysqld/mysqld. sock

I have tried all the above methods, but none of them have solved the problem. I'm about to give up, but I want to stick to it for one more time, and one will definitely solve it. I'm going to send an email to easychen, zoltan for advice. Just when I want to send an email, I wonder if I can change my thinking. My idea is: Since can't connect to socket '/var/run/mysqld/mysqld.sock' So when I link socket, don't I just add the socket parameter after it?

Namely: mysqladmin version --socket == /tmp/mysql.sock       

I'm so happy that something I didn't expect happened and the problem was solved. The problem has been solved, but I don't know why. Why is it the/var/run/mysqld/mysqld. sock by default? I checked 1 in the my. cnf file, and the socket path in client and mysqld is/tmp/mysql. sock, and the socket specified at compile time is/tmp/mysql. sock! I really don't understand this point. It seems that I have to find the answer on the Internet! I hope people familiar with the matter will give me more advice.

Let's introduce the problem of liunx mysql. sock separately

Error code: Can 't connect to local ES80server through socket'/var/lib/mysql/mysql. sock '

mysql. sock is not in the/var/lib/mysql directory at all. Your own directory is at/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 Object File ln Command Details:

Summarize


Related articles: