linux - mysql.sock is lost after restarting
ringa_lee
ringa_lee 2017-05-16 13:18:09
0
4
1001

mysql.sock was lost after Alibaba Cloud restarted

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

find / -name mysql.sockNothing

/usr/bin/mysql_install_dbsay failed

service mysql start says job failed

/ect/mysql/my.cnflog_error is under /var/log/mysql/error.log,
but/var/logThe following mysql.log and error.log are both empty, and the following /var/log/mysql/ Also,
there are also a bunch of mysql.log.1.gz compressed packages

Very urgent, more than 200 G of data

ringa_lee
ringa_lee

ringa_lee

reply all(4)
我想大声告诉你

Thank you for the invitation
mysql has two connection methods:
1, TCP/IP
2, socket
The function of mysql.sock is that the server and client are on the same server, and when localhost is used to connect, socket will be used. Connection - nothing more
That is: a MySQL connection established for the host name localhost. The connection process is implemented through a socket file mysql.socket. Therefore, after the file is deleted, the localhost user cannot connect to the MySQL server.
A tcp/ip connection must be established, that is, use 127.0.0.1 instead of localhost as the -h parameter to connect to the MySQL server, such as: mysqladmin -h 127.0.0.1 -u root -p shutdown, to forcefully establish a tcp/ip connection ;
Close the MySQL server, and then restart the MySQL server with localhost as the host name, and it will re-create a socket file.
Reprinted from
http://www.360doc.com/content...

为情所困

According to the description of the lock in the topic, I think it should be that the mysql process did not start after restarting and did not act as a daemon. You can test whether the mysql service is not started.

1、 端口是否打开
[root@ ~]# lsof -i:3306
COMMAND   PID  USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
mysqld  12207 mysql   14u  IPv4  52350      0t0  TCP *:mysql (LISTEN)
 
2、mysqld服务是否正在运行
[root@ ~]# service mysqld status
mysqld (pid  4717) is running...

3.若没启动服务
[root@ ~]# service mysqld start
淡淡烟草味

The solution to the problem of mysql.sock losing the last picture (it turns out that I also encountered this problem, the method is recorded below)

http://www.oddpi.com/thread-1...

Peter_Zhu

Regenerate a mysql.sock file

ln -s /tmp/mysql.sock /var/lib/mysql/mysql.sock
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template