当前位置: 首页 > news >正文

centOS8安装MySQL8设置开机自动启动失败

提供一个终极解决方案虽然systemctl 更符合管理预期但是不能用
使用一下命令 修改配置文件、修改mysql.service全是问题

systemctl start mysqld
systemctl enable mysqld
systemctl daemon-reload

完全不生效各种报错 提示配置文件内容有问题

Main process exited, code=exited, status=203/EXEC
[Unit]
Description=MySQL Database Server
After=network.target[Service]
Type=forking
User=mysql
Group=mysql
ExecStart=/etc/init.d/mysql start
ExecStop=/etc/init.d/mysql stop
ExecReload=/etc/init.d/mysql reload
Restart=on-failure[Install]
WantedBy=multi-user.target

配置文件修改多次提示的问题都是不一样的

● mysql.service - MySQL Database ServerLoaded: loaded (/etc/systemd/system/mysql.service; enabled; vendor preset: disabled)Active: inactive (dead) since Fri 2025-02-07 11:32:54 CST; 11min agoProcess: 2539 ExecStop=/etc/init.d/mysql stop (code=exited, status=0/SUCCESS)Process: 2497 ExecStart=/etc/init.d/mysql start (code=exited, status=0/SUCCESS)2月 07 11:32:54 localhost.localdomain systemd[1]: Starting MySQL Database Server...
2月 07 11:32:54 localhost.localdomain mysql[2497]: /etc/init.d/mysql:行239: my_print_defaults: 未找到命令
2月 07 11:32:54 localhost.localdomain mysql[2497]: Starting MySQL ERROR! Couldn't find MySQL server (/usr/local/mysql/bin/mysqld_safe)
2月 07 11:32:54 localhost.localdomain mysql[2539]: /etc/init.d/mysql:行239: my_print_defaults: 未找到命令
2月 07 11:32:54 localhost.localdomain mysql[2539]:  ERROR! MySQL server PID file could not be found!
2月 07 11:32:54 localhost.localdomain systemd[1]: Started MySQL Database Server.

直接修改这个文件 加上

vim /etc/rc.local
/etc/init.d/mysql start 

如果还是不行 加上

echo "Starting MySQL..." > /tmp/rc.local.log
/etc/init.d/mysql start >> /tmp/rc.local.log 2>&1
echo "MySQL start command executed." >> /tmp/rc.local.log

输出一下日志看一下什么问题修改一下即可。

http://www.lryc.cn/news/533996.html

相关文章:

  • 对接DeepSeek
  • SpringSecurity高级用法
  • NLP_[2]-认识文本预处理
  • 字符设备驱动开发
  • c语言:取绝对值
  • DeepSeek从入门到精通教程PDF清华大学出版
  • HTML之CSS定位、浮动、盒子模型
  • LQB(1)-python-各种基础排序
  • 解锁国内主流前端与后端框架
  • 使用OBS推流,srs服务器播放
  • 【鸿蒙HarmonyOS Next实战开发】多媒体视频播放-ijkplayer
  • GRU 和 LSTM 公式推导与矩阵变换过程图解
  • 现在中国三大运营商各自使用的哪些band频段
  • 使用Jenkins实现鸿蒙HAR应用的自动化构建打包
  • AI时代,职场人如何开启学习之旅
  • MIT6.824 Lecture 2-RPC and Threads Lecture 3-GFS
  • MySQL第五次作业
  • 【PDF提取内容】如何批量提取PDF里面的文字内容,把内容到处表格或者批量给PDF文件改名,基于C++的实现方案和步骤
  • 智慧机房解决方案(文末联系,领取整套资料,可做论文)
  • 【C编程问题集中营】使用数组指针时容易踩得坑
  • 【Redis】Linux、Windows、Docker 环境下部署 Redis
  • 反函数定义及其推导
  • 2025.2.9机器学习笔记:PINN文献阅读
  • Oracle数据连接 Dblink
  • fetch请求总结,fastadmin中后台接口强制返回json数据
  • 基于STM32的智能鱼缸水质净化系统设计
  • JAVA安全—FastJson反序列化利用链跟踪autoType绕过
  • 格式化字符串漏洞(Format String Vulnerability)
  • C++--iomanip库
  • Redis 集群原理、主从复制和哨兵模式的详细讲解