如何使用 systemctl 控制 mariadb 服务器?

如何使用 systemctl 控制 mariadb 服务器?

通过以下方式安装 MariaDB

apt install mariadb-server

想要启动它,但好像没有安装 mariadb-server.service:

systemctl enable mariadb
systemctl enable mariadb-server

他们都失败了。

dpkg -L mariadb-server-10.0 | grep service

什么都没显示。但是网络上有各种教程指导如何发出这些命令。

如何安装。服务文件以及它们为何不存在?

答案1

  • mariadb-server是一个元包,因此它是空的,并且仅为依赖项声明而创建

    ~$ apt-cache search "mariadb-server*"
    auth2db - Powerful and eye-candy IDS logger, log viewer and alert generator
    mariadb-server - MariaDB database server (metapackage depending on the latest version)
    mariadb-server-10.0 - MariaDB database server binaries
    mariadb-server-core-10.0 - MariaDB database core server files
    
    ~$ apt-cache depends mariadb-server
    mariadb-server
      Depends: mariadb-server-10.0
    
    ~$ apt-cache -i depends mariadb-server-10.0 
    mariadb-server-10.0
      PreDepends: adduser
      PreDepends: debconf
      PreDepends: mariadb-common
      Depends: libdbi-perl
      Depends: lsb-base
      Depends: mariadb-client-10.0
      Depends: mariadb-server-core-10.0
      Depends: passwd
        passwd:i386
      Depends: perl
      Depends: psmisc
        psmisc:i386
     |Depends: debconf
      Depends: <debconf-2.0>
        cdebconf
        debconf
      Depends: libaio1
      Depends: libc6
      Depends: libpam0g
      Depends: libstdc++6
      Depends: zlib1g
    
  • 它没有systemd条目,但是init.d有一个名称不同的条目。

    /etc/init.d/mysql

    systemd-sysv-generator应该已经生成了同名的服务文件,请检查:

     systemctl status mysql.service
    

相关内容