mysqld는 왜 항상 백그라운드에서 실행되나요?

mysqld는 왜 항상 백그라운드에서 실행되나요?

나는 그것을 알아 차렸다mysqld항상 백그라운드에서 실행 중입니다. 부팅할 때마다 시작되며, 종료한 후에도 다시 시작됩니다. 다음을 사용하여 mysql과 관련된 모든 것을 제거했습니다.

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

그러나 여전히 ps -aux. 이것의 의미는 무엇입니까? 또한 ps -aux 출력에서 ​​사용자 27은 무엇을 의미합니까? 사용자 27을 만든 기억이 없습니다.

설명: 사실 이는 백그라운드에서 실행 중인 SQL Docker 컨테이너 때문이었습니다.

답변1

mysqld가 포함된 도커 컨테이너가 실행 중인 것 같습니다.

답변2

나는 mysqld가 내 시스템에서 실행되고 있으며 3GB 이상의 RAM을 소모하고 있다는 것을 발견했습니다.

나는 다음과 같은 내용으로 조사를 시작했습니다.

sudo service --status-all

mysql이 실행 중인 항목 중 하나로 나열되었습니다(시스템 모니터에서도 확인했습니다.)

내 시스템에 Docker가 설치되어 있지 않습니다.

그런 다음 서비스 스크립트를 살펴보았습니다.

$ cat /etc/init.d/mysql

해당 스크립트의 일부 목록은 다음과 같습니다.

#!/bin/bash
#
### BEGIN INIT INFO
# Provides:          mysql
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Should-Start:      $network $time
# Should-Stop:       $network $time
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start and stop the mysql database server daemon
# Description:       Controls the main MySQL database server daemon "mysqld"
#                    and its wrapper script "mysqld_safe".
### END INIT INFO
#
set -e
set -u
${DEBIAN_SCRIPT_DEBUG:+ set -v -x}

test -x /usr/bin/mysqld_safe || exit 0

. /lib/lsb/init-functions

SELF=$(cd $(dirname $0); pwd -P)/$(basename $0)
CONF=/etc/mysql/my.cnf
MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf"

# priority can be overriden and "-s" adds output to stderr
ERR_LOGGER="logger -p daemon.err -t /etc/init.d/mysql -i"

# Safeguard (relative paths, core dumps..)
cd /
umask 077

# mysqladmin likes to read /root/.my.cnf. This is usually not what I want
# as many admins e.g. only store a password without a username there and
# so break my scripts.
export HOME=/etc/mysql/

## Fetch a particular option from mysql's invocation.
#
# Usage: void mysqld_get_param option
mysqld_get_param() {
    /usr/sbin/mysqld --print-defaults \
        | tr " " "\n" \
        | grep -- "--$1" \
        | tail -n 1 \
        | cut -d= -f2
}

## Do some sanity checks before even trying to start mysqld.
sanity_checks() {
  # check for config file
  if [ ! -r /etc/mysql/my.cnf ]; then
    log_warning_msg "$0: WARNING: /etc/mysql/my.cnf cannot be read. See README.Debian.gz"
    echo                "WARNING: /etc/mysql/my.cnf cannot be read. See README.Debian.gz" | $ERR_LOGGER
  fi

그런데, 이건 어디서 나온 걸까요? 내가 설치한 다른 프로그램이 mysql을 내 시스템에 추가했나요? 내가 기억하는 어떤 것도 수행되지 않았는데 왜 내 컴퓨터를 시작할 때 시작됩니까?

Snaps 및 Ubuntu 소프트웨어 및 기타 여러 곳을 검색했는데 Mysql을 직접 설치하지 않은 것 같습니다.

아마도 Java EE 등을 설치했을까요? 아마도 그럴 것입니다.

나는 다음을 실행했습니다 :

sudo systemctl --all list-unit-files --type=service

mysql에 대해 다음이 나열되어 있습니다.

UNIT_FILE                        STATE           VENDOR PRESET
mysql.service                    enabled         enabled

그런 다음 시작 시 서비스를 비활성화해야 했기 때문에 다음 명령을 실행했습니다.

sudo systemctl disable mysql.service

다시 확인해 보니 실제로 비활성화되어 있는 것으로 나타났습니다.

UNIT_FILE                        STATE           VENDOR PRESET
mysql.service                    disabled         enabled

관련 정보