centos 7 系统上重启 mysql 时报错 Failed to restart mysqld.service: Unit not found.

在 centos 7 系统上,使用常规命令:systemctl restart mysql 或 service mysqld restart 重启 mysql 时都会报如下错误:

cpp 复制代码
Failed to start mysqld.service: Unit not found.

根据所报错误,在网上搜罗了一圈,未果!!!

解决方案

1、执行如下命令,查看 mysql.server 路径

cpp 复制代码
find / -name mysql.server

执行结果如下所示:

路径说明如下:

cpp 复制代码
#mysql源码解压包
/usr/local/mysql-8.0.31/bld/support-files/mysql.server


#我在一台机器上装了两个mysql,端口号分别为:3306、3307

#端口号为3306的mysql
/usr/local/mysql/support-files/mysql.server

#端口号为3307的mysql
/usr/local/mysql3307/support-files/mysql.server

2、端口号为 3306 的 mysql 重启动

cpp 复制代码
/usr/local/mysql/support-files/mysql.server restart

3、端口号为 3306 的 mysql 启动

cpp 复制代码
/usr/local/mysql/support-files/mysql.server start

4、端口号为 3306 的 mysql 停止

cpp 复制代码
/usr/local/mysql/support-files/mysql.server stop
相关推荐
cg50171 小时前
MySQL数据库复杂的增删改查操作
数据库·mysql
夏炎正好眠7 小时前
mysql练习
数据库·mysql
驜鸈9 小时前
MySQL 的EXPLAIN 计划 type 字段详细说明
android·数据库·mysql
嗨起飞了10 小时前
MySQL入门手册
数据库·mysql
亦世凡华、10 小时前
快速部署:在虚拟机上安装 CentOS 7 的详细步骤
linux·运维·经验分享·centos·安装教程
程序员的世界你不懂11 小时前
Mysql配置文件My.cnf(my.ini)配置参数说明
数据库·mysql·百度·新浪微博
ChinaRainbowSea11 小时前
MySQL 索引的数据结构(详细说明)
java·数据结构·数据库·后端·mysql
追风赶月、11 小时前
【MySQL】事务(隔离性、MVCC)
数据库·mysql
Lemon_man_12 小时前
基于Django创建一个WEB后端框架(DjangoRestFramework+MySQL)流程
python·mysql·django
A仔不会笑14 小时前
MySQL面试篇——性能优化
java·数据库·mysql·面试·性能优化