MySQL 启动 登录报错Job for mysqld.service failed because the control process exited with error code. See

本文涉及的产品
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
云数据库 RDS MySQL,集群版 2核4GB 100GB
推荐场景:
搭建个人博客
RDS MySQL Serverless 高可用系列,价值2615元额度,1个月
简介: MySQL 启动 登录报错Job for mysqld.service failed because the control process exited with error code. See

启动数据库报错


Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.报错的情况


进入数据库报错


ERROR 2002 (HY000): Can't connect to local MySQL server through

socket '/var/lib/mysql/mysql.sock' (2)


问题出现的过程

我在通过(percona-xtrabackup)这款MySQL开源工具 做备份恢复 时候 遇见这样的问题

当时把整个数据库删掉 /var/lib/mysql/  下的所有文件删掉

然后通过以下命令恢复数据库

回滚事务日志
innobackupex --apply-log /2024-01-02_00-12-37  /后边是备份的地点
 
恢复数据库
innobackupex --copy-back /2024-01-02_00-12-37        

启动数据库的时候出现 报错

Job for mysqld.service failed because the control process exited 
with error code. See "systemctl status mysqld.service" and 
"journalctl -xe" for details.

进入数据库时报错

1. ERROR 2002 (HY000): Can't connect to local MySQL server through 
2. socket '/var/lib/mysql/mysql.sock' (2)
3.


解决过程

当我们删除 /var/log/mysql 下所有的文件

我们以root身份恢复数据库时候 属主和属组都是root

我们需要将它更改为 mysql

chown -R mysql.mysql /var/lib/mysql
 
systemctl restart mysqld
相关实践学习
如何在云端创建MySQL数据库
开始实验后,系统会自动创建一台自建MySQL的 源数据库 ECS 实例和一台 目标数据库 RDS。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助     相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
相关文章
|
4天前
|
网络协议 关系型数据库 MySQL
启动mysql时的异常为:[ERROR] Can‘t start server: Bind on TCP/IP port. Got error: 98: Address already in used
启动mysql时的异常为:[ERROR] Can‘t start server: Bind on TCP/IP port. Got error: 98: Address already in used
|
3天前
|
SQL 关系型数据库 MySQL
You have an error in your SQL syntax;check the manual that corresponds to you Mysql server version
You have an error in your SQL syntax;check the manual that corresponds to you Mysql server version
|
4天前
|
关系型数据库 MySQL 数据库
mysql 中登录报错:ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: YES)ERROR
mysql 中登录报错:ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: YES)ERROR
|
9天前
|
SQL 存储 关系型数据库
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server
|
4天前
|
XML Java 关系型数据库
Action:Consider the following: If you want an embedde ,springBoot配置数据库,补全springBoot的xml和mysql配置信息就好了
Action:Consider the following: If you want an embedde ,springBoot配置数据库,补全springBoot的xml和mysql配置信息就好了
|
4天前
|
关系型数据库 MySQL 数据库
关系型数据库mysql数据增量恢复
【7月更文挑战第3天】
13 2
|
4天前
|
关系型数据库 MySQL Shell
关系型数据库mysql数据完全恢复
【7月更文挑战第3天】
12 2
|
4天前
|
存储 关系型数据库 MySQL
|
6天前
|
存储 关系型数据库 MySQL
|
5天前
|
存储 关系型数据库 MySQL