systemctl start mysql.service报错问题

    xiaoxiao2025-12-22  12

    pid文件位置问题:

    cat /etc/systemd/system/mysql.service

    [Unit]

    Description=MySQL Server

    Documentation=man:mysqld(8)

    Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.html

    After=network.target

    After=syslog.target

    [Install]

    WantedBy=multi-user.target

    Alias=mysql.service

    [Service]

    User=mysql

    Group=mysql

    Type=forking

    PIDFile=/var/lib/mysql/Devops-mysql-slave-150.pid   //修改为正确的mysql pid位置

    # Disable service start and stop timeout logic of systemd for mysqld service.

    TimeoutSec=0

    # Execute pre and post scripts as root

    PermissionsStartOnly=true

    # Needed to create system tables

    ExecStartPre=/usr/bin/mysqld_pre_systemd

    # Start main service

    ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/lib/mysql/Devops-mysql-slave-150.pid $MYSQLD_OPTS    ## 修改pid位置

    # Use this to switch malloc implementation

    EnvironmentFile=-/etc/sysconfig/mysql

    # Sets open_files_limit

    LimitNOFILE = 5000

    Restart=on-failure

    RestartPreventExitStatus=1

    PrivateTmp=false

    启动 :

    systemctl start mysql.service

    如果嫌mysql.service 麻烦  ,可以修改Alias=mysql.service为mysqld

    systemctl start mysqld

    最新回复(0)