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
相关推荐
JZC_xiaozhong2 小时前
电商ERP如何同步订单数据到MySQL?集成方案解析
数据库·mysql·数据分析·etl工程师·嵌入式实时数据库·电商erp集成·数据集成与应用集成
-大头.4 小时前
Docker实战:构建高性能MySQL主从复制集群(读写分离)
mysql·docker·容器
burning_maple4 小时前
mysql数据库笔记
数据库·笔记·mysql
周某人姓周6 小时前
sqlilabs靶场通关详解
数据库·mysql·安全·网络安全
霖霖总总6 小时前
[小技巧41]InnoDB 如何判断一行数据是否可见?MVCC 可见性机制深度解析
数据库·mysql
Mr.徐大人ゞ8 小时前
生产可用的 MySQL8 一键安装脚本和一键巡检脚本
mysql
星梦清河9 小时前
MySQL—分组函数
数据库·mysql
霖霖总总9 小时前
[小技巧33]MySQL 事务持久化的一致性保障:binlog 与 redo log 的两阶段提交机制解析
数据库·mysql
ayaya_mana10 小时前
在 CentOS 7/RHEL 7 上安装并切换至新版内核
linux·运维·centos
消失的旧时光-194312 小时前
第五课:数据库不是存数据那么简单 —— MySQL 与索引的后端视角
数据库·mysql