• systemctl 配置mysql 开机启动


    在centos 7 环境下对服务的管理已经不再用service 命令了,而是改为systemctl 命令来管理服务.

    一、创建systemctl 的对mysql服务的配置文件

    touch /usr/lib/systemd/system/mysql.service
    # 注意systemctl 中规定、服务的配置文件要以.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
    
    [Service]
    User=mysql
    Group=mysql
    
    
    PIDFile=/usr/local/mysql/data/mysqld.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/local/mysql/bin/mysqld --daemonize --pid-file=/usr/local/mysql/data/mysqld.pid
    #注意这里要加上 --daemonize 
    # Use this to switch malloc implementation
    #EnvironmentFile=-/etc/sysconfig/mysql
    
    # Sets open_files_limit
    LimitNOFILE = 5000
    
    Restart=on-failure
    
    RestartPreventExitStatus=1
    
    PrivateTmp=false

    二、配置开机启动

    [root@workstudio system]# systemctl enable mysql
    Created symlink from /etc/systemd/system/multi-user.target.wants/mysql.service to /usr/lib/systemd/system/mysql.service.
    [root@workstudio system]# 

    三、启动mysql服务

    [root@workstudio system]# systemctl start mysql
    [root@workstudio system]# 
    [root@workstudio system]# ps -ef | grep mysql
    mysql      8910      1 10 10:33 ?        00:00:00 /usr/local/mysql/bin/mysqld --daemonize --pid-file=/usr/local/mysql/data/mysqld.pid
    root       8950   8625  0 10:33 pts/3    00:00:00 grep --color=auto mysql

    ---

  • 相关阅读:
    BUU-singal
    BUU-[GWCTF 2019]re3
    BUU-[2019红帽杯]xx
    BUU-BabyDriver
    BUU-simple CPP
    BUU-BJD hamburger competition
    BUU-Youngter-drive
    用于阻止div上的事件和div上的按钮的事件同时触发
    错误: java.lang.reflect.InvocationTargetException
    easy ui datagrid 让某行复选框不能选中
  • 原文地址:https://www.cnblogs.com/JiangLe/p/6932164.html
Copyright © 2020-2023  润新知