mysql - MySQL“启动”在 ubuntu 20.04 中失败
问题描述
我尝试运行命令:
sudo systemctl start mysql
并收到以下消息:
Job for mysql.service failed because the control process exited with error code.
See "systemctl status mysql.service" and "journalctl -xe" for details.
然后当我输入:
sudo systemctl status mysql.service
我收到以下消息:
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2021-03-02 11:32:34 IST; 58s ago
Process: 3383 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=1/FAILURE)
Mar 02 11:32:34 avivilloz systemd[1]: mysql.service: Scheduled restart job, restart counter is at 5.
Mar 02 11:32:34 avivilloz systemd[1]: Stopped MySQL Community Server.
Mar 02 11:32:34 avivilloz systemd[1]: mysql.service: Start request repeated too quickly.
Mar 02 11:32:34 avivilloz systemd[1]: mysql.service: Failed with result 'exit-code'.
Mar 02 11:32:34 avivilloz systemd[1]: Failed to start MySQL Community Server.
我搜索了几个小时,但找不到解决方案……有人知道可能是什么错误吗?
在此之前我唯一做的就是使用以下命令安装 mysql-server:
sudo apt-get install mysql-server
我尝试安装和重新安装、更新和升级 ubuntu,我不确定这是否会有所帮助。
提前致谢!
更新:
我刚刚检查过,我的计算机中没有 /var/lib/mysql 目录。但我无法通过重新安装 mysql 服务器/客户端来获得它。
解决方案
我通过“清除”与 mysql 相关的每个文件并重新安装 mysql-server 来修复:
sudo apt-get purge mysql-server mysql-client mysql-common
sudo apt-get install mysql-server
推荐阅读
- highcharts - Highcharts x-range 系列。如何裁剪数据内部的标签?
- python - 底图中坐标的不连贯处理
- node.js - 如何在 dynamoDB 上使用分页
- javascript - 如何在 ReactJS 中简化 setTimeout
- flask - File_x 存在于 gCloud 目录中,但 gcloud deploy 为 File_x 提供 FileNotFoundError
- vhdl - VHDL 参数划分电路 - 书籍:VHDL 示例的 FPGA 原型设计,Pong Chu
- excel - Excel Vb 向多个收件人发送电子邮件
- database - 添加新数据时的Java FX数据库问题
- spring - 使用 Spring 和 Apache 文件上传时如何模拟多部分文件上传
- git - jenkins git clone 错误:克隆远程 repo 'origin' 时出错