我在 /etc/init.d 文件夹中找不到 mysql

我在 /etc/init.d 文件夹中找不到 mysql
● mysql.service - MySQL Community Server
   Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2018-08-31 18:03:37 KST; 9min ago
  Process: 6005 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid (code=exited, status=0/SUCCESS)
  Process: 5996 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
 Main PID: 6007 (mysqld)
    Tasks: 30 (limit: 4915)
   CGroup: /system.slice/mysql.service
           └─6007 /usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid

 Aug 31 18:03:37 lenovo-g50-45 mysqld[6005]: 2018-08-31T09:03:37.409469Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
 Aug 31 18:03:37 lenovo-g50-45 mysqld[6005]: 2018-08-31T09:03:37.409772Z 0 [Warning] CA certificate ca.pem is self signed.
 Aug 31 18:03:37 lenovo-g50-45 mysqld[6005]: 2018-08-31T09:03:37.413194Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
 Aug 31 18:03:37 lenovo-g50-45 mysqld[6005]: 2018-08-31T09:03:37.413243Z 0 [Note] IPv6 is available.
 Aug 31 18:03:37 lenovo-g50-45 mysqld[6005]: 2018-08-31T09:03:37.413255Z 0 [Note]   - '::' resolves to '::';
 Aug 31 18:03:37 lenovo-g50-45 mysqld[6005]: 2018-08-31T09:03:37.413294Z 0 [Note] Server socket created on IP: '::'.
 Aug 31 18:03:37 lenovo-g50-45 mysqld[6005]: 2018-08-31T09:03:37.427078Z 0 [Note] Event Scheduler: Loaded 0 events
 Aug 31 18:03:37 lenovo-g50-45 mysqld[6005]: 2018-08-31T09:03:37.427439Z 0 [Note] /usr/sbin/mysqld: ready for connections.
 Aug 31 18:03:37 lenovo-g50-45 mysqld[6005]: Version: '5.7.23-0ubuntu0.18.04.1'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  (Ubuntu)
 Aug 31 18:03:37 lenovo-g50-45 systemd[1]: Started MySQL Community Server.

与上述情况一样,重启电脑后MySQL可以正常启动,但奇怪的是,文件夹中没有任何名为“mysql”的文件/etc/init.d

如何在启动 PC 时不带初始化脚本启动 MySQL?如何将 MySQL 添加到 init.d 文件夹?

答案1

您的输出表明 MySQL 服务文件位于/lib/systemd/system/mysql.service

/etc/init.d是遗留的,开发人员已经调整了软件以由 systemd 启动。

相关内容