美文网首页
重启mysql找不到mysql.service,原来是使用了Ma

重启mysql找不到mysql.service,原来是使用了Ma

作者: 沙蒿同学 | 来源:发表于2020-02-06 16:05 被阅读0次

    我的/etc/my.cnf配置为

    [mysqld]
    datadir=/var/lib/mysql
    socket=/var/lib/mysql/mysql.sock
    # Disabling symbolic-links is recommended to prevent assorted security risks
    symbolic-links=0
    # Settings user and group are ignored when systemd is used.
    # If you need to run mysqld under a different user or group,
    # customize your systemd unit file for mariadb according to the
    # instructions in http://fedoraproject.org/wiki/Systemd
    #skip-grant-tables
    
    
    [mysqld_safe]
    log-error=/var/log/mariadb/mariadb.log
    pid-file=/var/run/mariadb/mariadb.pid
    
    
    #
    # include all files from the config directory
    #
    !includedir /etc/my.cnf.d
    
    

    今天需要重启MySQL,不过找了没找好久也没有到mysql.service文件,最后服务器是利用MariaDB来管理MySQL。
    查看系统的服务列表

    systemctl list-dependencies
    
    image.png

    使用mariadb.service代替mysql.service或mysqld.service来重启mysql

    service mariadb.service restart
    service mariadb.service start
    service mariadb.service stop
    

    或者可以这样做:

    systemctl restart mariadb.service
    systemctl start mariadb.service
    systemctl stop mariadb.service

    然后你就可以去修改mysql的账号密码等操作了

    相关文章

      网友评论

          本文标题:重启mysql找不到mysql.service,原来是使用了Ma

          本文链接:https://www.haomeiwen.com/subject/lhluxhtx.html