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.sock
Nothing
/usr/bin/mysql_install_db
say failed
service mysql start
says job failed
/ect/mysql/my.cnf
log_error
is under /var/log/mysql/error.log
,
but/var/log
The 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
我想大声告诉你2017-05-16 13:20:09
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...
为情所困2017-05-16 13:20:09
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
淡淡烟草味2017-05-16 13:20:09
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...
天蓬老师2017-05-16 13:20:09
Regenerate a mysql.sock file
ln -s /tmp/mysql.sock /var/lib/mysql/mysql.sock