programing

mysqld.service 작업에 실패했습니다. "systemctl status mysqld.service"를 참조하십시오.

prostudy 2022. 9. 8. 21:22
반응형

mysqld.service 작업에 실패했습니다. "systemctl status mysqld.service"를 참조하십시오.

콘솔에 표시됨

[root@ip-172-31-18-2 mysql]# service mysqld start
Starting mysqld (via systemctl):  Job for mysqld.service failed because the control process exited with an error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.

mysqld.service

[root@ip-172-31-18-2 mysql]# systemctl status mysqld.service
● mysqld.service - SYSV: MySQL database server.
   Loaded: loaded (/etc/rc.d/init.d/mysqld)
   Active: failed (Result: exit-code) since Sat 2017-02-18 20:59:17 IST; 36s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 9925 ExecStart=/etc/rc.d/init.d/mysqld start (code=exited, status=1/FAILURE)

Feb 18 20:59:16 ip-172-31-18-2.ap-southeast-1.compute.internal systemd[1]: Starting SYSV: MySQL database server....
Feb 18 20:59:17 ip-172-31-18-2.ap-southeast-1.compute.internal mysqld[9925]: MySQL Daemon failed to start.
Feb 18 20:59:17 ip-172-31-18-2.ap-southeast-1.compute.internal mysqld[9925]: Starting mysqld:  [FAILED]
Feb 18 20:59:17 ip-172-31-18-2.ap-southeast-1.compute.internal systemd[1]: mysqld.service: control process exited, code=exited status=1
Feb 18 20:59:17 ip-172-31-18-2.ap-southeast-1.compute.internal systemd[1]: Failed to start SYSV: MySQL database server..
Feb 18 20:59:17 ip-172-31-18-2.ap-southeast-1.compute.internal systemd[1]: Unit mysqld.service entered failed state.
Feb 18 20:59:17 ip-172-31-18-2.ap-southeast-1.compute.internal systemd[1]: mysqld.service failed.

지금까지의 시도:

mysqld_safe --defaults-file=/etc/my.cf

chown -R mysql:mysql /var/lib/mysql

/etc/init.d/mysqld start

 /etc/init.d/mysqld stop

systemctl restart systemd-logind

서버를 재기동했다.

여전히 운이 없다.

my.cnf 파일

# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html

[mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for a dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

이거 대박이다.

/etc/init.d/mysql stop
service mysql stop
killall -KILL mysql mysqld_safe mysqld
/etc/init.d/mysql start
service mysql start

같은 에러가 발생했는데, 문제는 디스크 용량이 부족했기 때문입니다.공간을 확인하려면 다음을 수행합니다.

$ df -h

디스크 용량

그런 다음 필요하지 않은 일부 파일을 삭제합니다.

이 명령어 후:

service mysql start
systemctl status mysql.service
mysql -u root -p

루트 비밀번호를 입력한 후 mysql 서비스가 활성화되었는지 확인합니다.

저는 오늘 이 문제를 만나서 풀풀한 절차로 해결했습니다.

로그 1, 을 합니다./var/log/mysqld.log

tail -f /var/log/mysqld.log

 2017-03-14T07:06:53.374603Z 0 [ERROR] /usr/sbin/mysqld: Can't create/write to file '/var/run/mysqld/mysqld.pid' (Errcode: 2 - No such file or directory)
 2017-03-14T07:06:53.374614Z 0 [ERROR] Can't start server: can't create PID file: No such file or directory

이나 디렉토리가 /var/run/mysqld/mysqld.pid

2, 을 ./var/run/mysqld

mkdir -p /var/run/mysqld/

를 다시 합니다 3. mysqld를 다시 시작합니다.service mysqld start해 주세요.로그를 다시 확인해 주세요./var/log/mysqld.log

2017-03-14T07:14:22.967667Z 0 [ERROR] /usr/sbin/mysqld: Can't create/write to file '/var/run/mysqld/mysqld.pid' (Errcode: 13 - Permission denied)
2017-03-14T07:14:22.967678Z 0 [ERROR] Can't start server: can't create PID file: Permission denied

허가가 거부되었다고 되어 있습니다.

mysql 4. mysql에 합니다.chown mysql.mysql /var/run/mysqld/

5. mysqld를 재시작합니다.

# service mysqld restart
Restarting mysqld (via systemctl):                         [  OK  ]

이를 수정하기 위해 수행한 단계는 다음과 같습니다.

/etc/mysql에서 my.cnf 파일을 백업하고 삭제 또는 이름을 변경합니다.

sudo mv /etc/mysql/my.cnf /etc/mysql/my.cnf.bak

/etc/mysql/mysql.conf.d/ 폴더를 삭제합니다.

sudo rm -r /etc/mysql/mysql.conf.d/

my.cnf 파일이 다른 곳에 저장되어 있지 않은지 확인합니다(홈디르에 저장되어 있습니다).또한 /etc/alternates/my.cnf를 사용하고 있습니다.

sudo find / -name my.cnf

모든 것을 재설치합니다.

sudo apt purge mysql-server mysql-server-5.7 mysql-server-core-5.7
sudo apt install mysql-server

syslog에 "mysqld: Cannot read dir of /etc/mysql/conf.d/"와 같은 오류가 표시되는 경우 심볼 링크를 만듭니다.

sudo ln -s /etc/mysql/mysql.conf.d /etc/mysql/conf.d

그러면 sudo service mysql start에서 서비스를 시작할 수 있습니다.

잘 됐으면 좋겠다

제 이 오류가 은 이 오류가 되었기 때문입니다./var/log/mysqlmysql-server「5.7.21-1」입니다.strace ★★★★★★★★★★★★★★★★★」sudo /usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid은 (이)systemd(미국의이 문제는 다음과 같이 판명되었습니다.

2019-01-01T09:09:22.102568Z 0 [ERROR] Could not open file '/var/log/mysql/error.log' for error logging: No such file or directory

최근 에 있는 여러 디렉토리의 내용을 삭제했습니다./var/log놀랄 일도 아니었다.하게 하는 이었습니다.mysql in " " 。

$ sudo mkdir /var/log/mysql
$ sudo chown -R mysql:mysql /var/log/mysql

그렇게 하고 나서, 나는 행복하게 로그인을 했다.sudo mysql -u root 친숙한 를 나눴다.mysql>

만약 당신의 문제가 해결되지 않는다면, 당신은 더 많은 문제를 체크할 수 있습니다.

mysql 크래시는 다음과 같습니다.

로그인 확인 가능

sudo cat /var/log/mysql/error.log

또는 확인하세요.

sudo ls /var/sudo

해라

sudo chown mysql:mysql -R /var/lib/mysql

그러면 mysql 서비스를 시작합니다.

systemctl start mysqld

이 문제는 "/etc/disc/my.cnf"에 있습니다.이 파일은 설치한 다른 라이브러리에서 수정해야 합니다.원래 모양은 다음과 같습니다.

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, version 2.0,
# as published by the Free Software Foundation.
#
# This program is also distributed with certain software (including
# but not limited to OpenSSL) that is licensed under separate terms,
# as designated in a particular file or component or in included license
# documentation.  The authors of MySQL hereby grant you an additional
# permission to link the program and your derivative works with the
# separately licensed software that they have included with MySQL.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License, version 2.0, for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA

#
# The MySQL  Server configuration file.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

# * IMPORTANT: Additional settings that can override those from this file!
#   The files must end with '.cnf', otherwise they'll be ignored.
#

!includedir /etc/mysql/conf.d/
    
!includedir /etc/mysql/mysql.conf.d/

나 또한 같은 문제에 직면해 있었다.

root@*******:/root >mysql -uroot -password

mysql : [ Warning ]명령줄 인터페이스에서 패스워드를 사용하는 것은 안전하지 않을 수 있습니다.오류 2002(HY000):소켓 '/var/lib/mysql/mysql'을 통해 로컬 MySQL 서버에 연결할 수 없습니다.양말' (2)

I found ROOT FS was also full and then I killed below lock session . 
root@**********:/var/lib/mysql >ls -ltr
total 0
-rw------- 1 mysql mysql 0 Sep  9 06:41 mysql.sock.lock

드디어 문제가 해결되었습니다.

  1. my.cnf 파일을 합니다.log-error 스루프

  2. 한 로그 을 확인합니다.
    $ ls -l /var/log/mysql.log

  3. 권한이 mysql될 수 있는 을 "mysql:"로 하십시오.
    $ chown -R mysql:mysql /var/log/mysql.log

  4. mysql 를 재시작합니다.
    $ service mysql restart || systemctl restart mysqld

주의: 이러한 오류는 권한 문제로 인해 발생합니다.모든 mysql service start 명령어는 로그 파일을 사용하여 mysql 상태를 기록합니다.권한이 변경된 경우 서비스는 로그 파일에 아무것도 쓸 수 없습니다.이 경우 서비스 실행이 중지됩니다.

/etc/my.cnf에서 "secure_file_priv" 명령을 삭제하고 mysql을 재시작합니다.mysql에서 파일을 사용하려면 해당 파일을 메인 폴더에 복사합니다.메인 폴더는 다음과 같이 취득됩니다.SHOW VARIABLES LIKE "secure_file_priv";

다음 명령을 사용하여 모든 mysql 관련 패키지를 삭제하고 다시 설치할 수 있습니다.

PACKAGES="mysql-server mysql-community-server mysql-community-server-core mysql-client mysql-client mysql-community-client mysql-community-client-core  mysql-common mysql-community-client-plugins php-mysql"
apt purge $PACKAGES
echo "any remaining installed packages:"
dpkg -l|grep ii|grep mysql
apt install --reinstall mysql-common
apt install $PACKAGES

패키지가 (「」외)mysql-core

구성 또는 데이터를 백업하고 mysql을 다시 설치합니다.

sudo apt remove --purge mysql-server
sudo apt purge mysql-server
sudo apt autoremove
sudo apt autoclean
sudo apt remove dbconfig-mysql


sudo apt-get remove --purge mysql* -y
sudo apt-get autoremove -y
sudo apt-get autoclean

그런 다음 다시 설치합니다.

여기서 먹히네요.

자세한 내용은 systemctl status mysql.service와 journalctl -xe가 동일합니다.에러. 설치와 설치를 반복해도 전혀 동작하지 않습니다.그러나 이것은 정상적으로 동작합니다> https://linuxtut.com/en/5a5b0f46620ae1b27b10/

my.cnf 파일에서 [mysqld]를 제외한 모든 파일을 삭제하고 서버를 부팅하기만 하면 됩니다.이 경우 root 비밀번호가 없을 수 있지만 skip-module을 사용하여 서버를 세이프 모드로 재시작하고 mysql 및 update mysql.user set authentication_string=inters를 사용하여 user='root'로 식별되는 사용자 'root'@'localhost'를 변경할 수 있습니다. 그런 다음 보안 모드에 로그인하여 새 사용자를 생성할 수 있습니다.

그리고 당신의 도커 컨테이너를 확인하는 것도 잊지 마세요. 제 도커에는 백그라운드에서 mysql이 실행되고 있었습니다.

  1. SSH 를 사용해 서버에 접속합니다.

  2. 영향을 받는 MySQL 서비스와 서비스 plesk-web-socket을 중지하여 MySQL을 시작하지 않도록 합니다.

    service mysql stop || service mariadb stop && service plesk-web-socket stop
    
  3. 모든 MySQL 데이터 저장소 파일을 백업합니다.디폴트로는, 이것들은 디렉토리에 있습니다./var/lib/mysql/.

    예를 들어 다음과 같습니다.

    cp -a /var/lib/mysql /root/mysql_backup
    
  4. 매개 변수 추가innodb_force_recovery섹션까지[mysqld]MySQL 컨피규레이션파일을 참조해 주세요.이 옵션을 사용하면 MySQL 서비스를 복구 모드로 시작하고 데이터베이스 덤프를 만들 수 있습니다.

    예를 들어 다음과 같습니다.

    vi /etc/my.cnf
    [mysqld]
    innodb_force_recovery = 2
    
  5. MySQL 서비스를 시작합니다.

같은 문제가 있었어.아래와 같이 해결합니다.명령어 사용:

sudo tail -f /var/log/messages|grep -i mysql

SELinux 정책이 문제의 원인인지 여부를 확인합니다.이 경우 먼저 명령을 사용하여 SELinux 정책이 활성화되었는지 확인합니다.#sestatus유효하게 표시되어 있는 경우는, 무효로 합니다.비활성화 방법:

  1. # vi /etc/sysconfig/selinux
  2. 'SELINUX=disabled'를 'SELINUX=disabled'로 변경합니다.
  3. Linux 재부팅
  4. 에 확인하다.sestatus'disabled'라고 표시되어야 합니다.

mysql을 제거하고 다시 설치합니다.효과가 있을 거예요.

언급URL : https://stackoverflow.com/questions/42317139/job-for-mysqld-service-failed-see-systemctl-status-mysqld-service

반응형