Digital Ocean CentOS7 서버, --skip-grant-tables 또는 mysql을 재시작 할 수 없음


9

며칠 전에 Digital Ocean 드롭 릿 (서버)을 설정했으며 mysql에 액세스해야합니다. 내가 시도한 것 중에 root의 암호가 작동하지 않습니다. 그러나이 명령은 다음과 같습니다.

service mysql[d] stop

작동하지 않습니다. 분명히이 명령을 발행해야합니다.

sudo systemctl stop mariadb.service

그러나 그 결과

Failed to stop mariadb.service: Unit mariadb.service not loaded.

또한이 명령

mysqld_safe --skip-grant-tables --skip-networking & mysql -u root

이 응답의 결과 :

sudo: mysqld_safe: command not found
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
[1]+  Exit 1   sudo mysqld_safe --skip-grant-tables --skip-networking

서버에 루트로 로그인했습니다. 여기서 무엇을해야합니까?


먼저, MySQL을 설치했는지, MariaDB를 설치했는지 또는 가능할 것 같은지 기억해야합니다.
— Michael Hampton

이 명령의 출력은 무엇입니까? 'rpm -qa | grep mariadb '및'rpm -qa | grep mysqld '및'rpm -qa | grep mysql '
— Anthony Fornito

감사합니다 @AnthonyFornito, mariadb mariadb-5.5.50-1.el7_2.x86_64 mariadb-libs-5.5.50-1.el7_2.x86_64의 출력은 mysql의 출력 이었습니다-mysqld는 php-mysql-5.4.16-36.3.el7_2.x86_64아무것도 반환하지 않았습니다.
— Oliver Williams

@MichaelHampton-서버에 둘 다있는 것 같습니다.
— Oliver Williams

정말? 나는 거기에 MariaDB 만 보입니다.
— Michael Hampton

답변:


10

시험

yum remove mysql

그런 다음 시도하십시오

service mariadb restart

그런 다음에서 밖을 봐

service mariadb status

당신은 그것을 실행 한 다음 일찍 시도한 명령이 작동하는 것을 볼 수 있습니다

만약

 yum remove mysql

작동하지 않습니다

 chkconfig mysql off

재부팅하고 마리아를 다시 시작하십시오.


첫 번째 부분에서는 성공하지 못했습니다. [root @ centos-8gb-nyc2-01 ~] # service mariadb restart-/ bin / systemctl로 리디렉션으로 다시 시작 mariadb.service-mariadb.service를 다시 시작하지 못했습니다 : unit mariadb.service를로드하지 못했습니다 : 해당 없음 파일 또는 디렉토리. [root @ centos-8gb-nyc2-01 ~] # service mariadb status / bin / systemctl status로 리디렉션 리디렉션 mariadb.service ● mariadb.service로드 됨 : 찾을 수 없음 (이유 : 해당 파일 또는 디렉토리가 없음) 활성 : 비활성 (죽음)
— Oliver Williams

ckconfig-bash : 명령을 찾을 수 없음 오류 만 발생합니다.
— Oliver Williams

chkconfig <-h를 잊었다
— Anthony Fornito

재부팅 후 yum install mariadb
— Anthony Fornito

chkconfig는 sysv 서비스에서만 작동합니다 systemctl enable. 사용해야 합니다.
— user9517
당사 사이트를 사용함과 동시에 당사의 쿠키 정책과 개인정보 보호정책을 읽고 이해하였음을 인정하는 것으로 간주합니다.
Licensed under cc by-sa 3.0 with attribution required.