AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题 / 1269833
Accepted
ganto
ganto
Asked: 2020-08-25 13:23:50 +0800 CST2020-08-25 13:23:50 +0800 CST 2020-08-25 13:23:50 +0800 CST

为什么mysqld总是在后台运行?

  • 772

我注意到mysqld总是在后台运行。它在每次启动时启动,即使在我杀死它之后,它也会重新启动。我已经删除了与 mysql 相关的所有内容:

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

但是,它仍然出现在ps -aux. 这个东西的意思是什么 ?另外,用户 27 在 ps -aux 的输出中是什么意思?我不记得创建用户 27。

解释:其实是因为后台运行了一个sql docker容器

mysql process
  • 2 2 个回答
  • 533 Views

2 个回答

  • Voted
  1. Best Answer
    Gordan Bobić
    2020-08-25T21:12:33+08:002020-08-25T21:12:33+08:00

    听起来您正在运行一个包含 mysqld 的 docker 容器。

    • 0
  2. raddevus
    2022-05-06T12:59:21+08:002022-05-06T12:59:21+08:00

    我发现 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
    
    • 0

相关问题

  • 从终端备份mysql

  • 为什么 /etc/init.d/mysql 会运行错误的暴发户工作?

  • 将引号添加到文件中的字符串

  • 为什么有 60 多个控制台套件守护进程?

  • 如何将 MySQL 数据文件移动到不同的分区?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve