code

centos : 동일한 유닉스 소켓으로 이미 실행중인 다른 MySQL 데몬

codestyles 2020. 10. 13. 07:49
반응형

centos : 동일한 유닉스 소켓으로 이미 실행중인 다른 MySQL 데몬


mysqld 서비스를 시작할 때 이상한 오류가 발생합니다.

Another MySQL daemon already running with the same unix socket.

실행중인 서비스를 나열하고 중지하려고 시도했지만 mysqld 서비스를 시작할 때 동일한 오류가 발생합니다.

mysqld를 제거하고 다시 설치할 수 있지만 데이터베이스도 제거됩니까?


문제가 발생하지 않도록하려면 서버의 전원을 끄는 대신 명령 줄에서 서버를 정상적으로 종료해야합니다.

# shutdown -h 지금

이렇게하면 컴퓨터의 전원을 끄기 전에 실행중인 서비스가 중지됩니다.

Centos를 기반으로이 문제가 발생할 때 다시 백업하는 추가 방법은 mysql.sock을 이동하는 것입니다.

# mv /var/lib/mysql/mysql.sock /var/lib/mysql/mysql.sock.bak

# service mysqld start

서비스를 다시 시작하면 mqsql.sock이라는 새 항목이 생성됩니다.


TL; DR :

이것을 루트로 실행하면 모든 설정이 완료됩니다.

rm $(grep socket /etc/my.cnf | cut -d= -f2)  && service mysqld start

더 긴 버전 :

수동으로에서 /etc/my.conf또는 다음을 사용하여 MySQL 소켓 파일의 위치를 ​​찾을 수 있습니다.

grep socket /etc/my.cnf | cut -d= -f2

일 가능성이 높습니다 /var/lib/mysql/mysql.sock. 그런 다음 (물론 루트로 또는 sudo앞에 추가하여) 해당 파일을 제거하십시오.

rm /var/lib/mysql/mysql.sock

그런 다음 MySQL 데몬을 시작합니다.

service mysqld start

제거해 mysqld도 문제가 전혀 해결되지 않습니다. 문제는 CentOS와 RedHat가 sock충돌 후 파일을 정리하지 않기 때문에 직접 처리해야한다는 것입니다. 시스템 전원을 끄는 것도 권장되지만 때로는 피할 수 없으므로이 절차를 통해 문제를 해결할 수 있습니다.


이 문제에 대한 해결책을 찾았습니다. 소켓 디렉토리를 my.cnf 파일의 새 위치로 변경하십시오.

socket=/var/lib/mysql/mysql2.sock

service mysqld start

또는 GeckoSEO가 대답 한 빠른 방법

# mv /var/lib/mysql/mysql.sock /var/lib/mysql/mysql.sock.bak

# service mysqld start

이에 대한 나의 해결책은 하드 종료로 인해 / var / lib / mysql / 디렉토리에 mysql.sock이 남았습니다. Mysql은 실행 중이 아닐 때 이미 실행 중이라고 생각했습니다.


OS 공급 업체에서 소켓을 / var / run에 넣으라고 요청하는 버그 보고서를 열어 재부팅하면 자동으로 제거됩니다. 불완전한 재부팅 후에이 소켓을 유지하는 것은 버그입니다. / var / run은 이러한 종류의 파일에 대한 스팟입니다.


자동으로 .sock 파일을 정리하려면 "start)"코드 블록 바로 뒤에 /etc/init.d/mysqld 파일에이 줄을 배치합니다.

test -e /var/lib/mysql/mysql.sock
SOCKEXIST=$?

ps cax | grep mysqld_safe
NOPIDMYSQL=$?

echo NOPIDMYSQL $NOPIDMYSQL
echo SOCKEXIST $SOCKEXIST

if [ $NOPIDMYSQL -eq 1 ] && [ $SOCKEXIST -eq 0 ] ; then
    echo "NOT CLEAN"
    rm -f /var/lib/mysql/mysql.sock
    echo "FILE SOCK REMOVED"
else
    echo "CLEAN"
fi

그것은 나를 위해 일했습니다. 저는 UPS가없고 종종 전원 공급 장치가 고장 나기 때문에 이것을해야했습니다.

문안 인사.


OS 재부팅 중 MySQL 서비스가 제대로 종료되지 않는 경우가 있습니다. /var/lib/mysql/mysql.sock이 남아 있습니다. 이렇게하면 'mysqld'가 시작되지 않습니다.

다음 단계가 도움이 될 수 있습니다.

1: service mysqld start killall -9 mysqld_safe mysqld service mysqld start

2: rm /var/lib/mysql/mysql.sock service mysqld start


To start the MySQL service, you can remove '/var/lib/mysql/mysql.sock' and start the MySQL service again:

Remove the socket file:

[root@server ~]# rm /var/lib/mysql/mysql.sock
rm: remove socket `/var/lib/mysql/mysql.sock'? yes

Start the MySQL service:

[root@server~]# service mysqld start
Starting mysqld:                                           [  OK  ]

It will help you to resolve your problem.


It's just happen because of abnormal termination of mysql service. delete or take backup of /var/lib/mysql/mysql.sock file and restart mysql.

Please let me know if in case any issue..


I just went through this issue and none of the suggestions solved my problem. While I was unable to start MySQL on boot and found the same message in the logs ("Another MySQL daemon already running with the same unix socket"), I was able to start the service once I arrived at the console.

In my configuration file, I found the following line: bind-address=xx.x.x.x. I randomly decided to comment it out, and the error on boot disappeared. Because the bind address provides security, in a way, I decided to explore it further. I was using the machine's IP address, rather than the IPv4 loopback address - 127.0.0.1.

In short, by using 127.0.0.1 as the bind-address, I was able to fix this error. I hope this helps those who have this problem, but are unable to resolve it using the answers detailed above.

참고URL : https://stackoverflow.com/questions/20407292/centos-another-mysql-daemon-already-running-with-the-same-unix-socket

반응형