systemctl status mysqld.service或者systemctl start mysqld 启动失败的解决办法

这篇具有很好参考价值的文章主要介绍了systemctl status mysqld.service或者systemctl start mysqld 启动失败的解决办法。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

报错过程:

mysql需要启动,执行一下命令启动mysql:

systemctl start  mysqld.service

结果出现如下提示

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

在这里给大家一个提示,因为每个人的报错原因不同,我们需要去查看mysql的日志

vi /var/log/mysqld.log

如果mysql日志太多,可以通过dG将mysql的日志全部删除,之后再执行启动musql的命令

systemctl start  mysqld.service
vi /var/log/mysqld.log  // 查看报错日志

找到日志中出现error的地方,根据具体问题搜索具体博客的解决办法

我的日志文件中报错大致如下。

mysqld: Table 'mysql.plugin' doesn't exist
2021-04-27T08:55:46.468329Z 0 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
2021-04-27T08:55:46.468825Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2021-04-27T08:55:46.470106Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
2021-04-27T08:55:46.470119Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
2021-04-27T08:55:46.471231Z 0 [Warning] CA certificate ca.pem is self signed.
2021-04-27T08:55:46.471281Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
2021-04-27T08:55:46.472264Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
2021-04-27T08:55:46.472311Z 0 [Note] IPv6 is available.
2021-04-27T08:55:46.472322Z 0 [Note]   - '::' resolves to '::';
2021-04-27T08:55:46.472345Z 0 [Note] Server socket created on IP: '::'.
2021-04-27T08:55:46.472543Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2021-04-27T08:55:46.472624Z 0 [Note] InnoDB: Buffer pool(s) load completed at 210427 16:55:46
2021-04-27T08:55:46.476676Z 0 [Warning] Failed to open optimizer cost constant tables
 
2021-04-27T08:55:46.476791Z 0 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
2021-04-27T08:55:46.476806Z 0 [ERROR] Fatal error: Failed to initialize ACL/grant/time zones structures or failed to remove temporary table files.
2021-04-27T08:55:46.476836Z 0 [ERROR] Aborting

从上面的报错可以看出,Mysql初始化出了问题。执行以下命令:

cd /   
rm -rf /var/lib/mysql/*
mysqld --initialize --user=mysql --datadir=/var/lib/mysql

之后重启mysql 并查看mysql的状态

systemctl restart mysqld
systemctl status mysqld

systemctl status mysqld.service,mysql,数据库,服务器
MySQL第一次启动后会创建超级管理员账号root@localhost,初始密码存储在日志文件中,查看密码

sudo grep 'temporary password' /var/log/mysqld.log

systemctl status mysqld.service,mysql,数据库,服务器
可以看到,我的初始密码为 iFqxsrSB&10o,准备登陆

mysql -uroot -p 

systemctl status mysqld.service,mysql,数据库,服务器
登陆成功后,修改密码,并开启访问权限

set global validate_password_length=4;      # 设置密码长度最低位数,适用于老版本
set global validate_password_policy=LOW;	# 设置密码安全等级低,便于密码可以修改成root,适用于老版本
set password=password('root');				# 设置密码为root

# 开启访问权限
grant all on *.* to 'root'@'%' identified by 'root';
flush privileges;

systemctl status mysqld.service,mysql,数据库,服务器
之后退出mysql,再次通过root密码登录mysql

mysql -uroot -proot

systemctl status mysqld.service,mysql,数据库,服务器
登陆成功!文章来源地址https://www.toymoban.com/news/detail-712512.html

到了这里,关于systemctl status mysqld.service或者systemctl start mysqld 启动失败的解决办法的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • Linux服务器中启动mysql出现Redirecting to /bin/systemctl start mysql.service错误及处理

    service mysql start 启动mysql服务器时,提示如下错误: 原因推测: service mysql start 是重定向到 /bin/systemctl restart mysql.service. mysql 与mysqld是不同的,前者交互式命令(客户端),mysqld才是后端服务进程,应该是启错了 使用 service mysqld start 或者 systemctl start mysqld 启动 附:其他操作

    2024年02月13日
    浏览(43)
  • 计算节点systemctl status openstack-nova-compute.service起不来的解决方案

    报错 [root@compute ~]# systemctl start libvirtd.service openstack-nova-compute.service Job for openstack-nova-compute.service failed because the control process exited with error code. See \\\"systemctl status openstack-nova-compute.service\\\" and \\\"journalctl -xe\\\" for details. ● openstack-nova-compute.service - OpenStack Nova Compute Server    Loaded: loade

    2024年02月03日
    浏览(29)
  • 解决mysqld服务启动失败

    原因如下: 1、进程占用 首先查看下mysql进程:        ps -aux | grep \\\'mysql\\\' 有进程号占用了,kill  这个进程号 再重启服务   2、所有者和所属组为mysql 查看/usr/local/MySQL/data/mysqld.pid所有者和所属组是否为mysql 原来是权限有问题,那么更改权限(还需要加权限) 3、 重新启动服

    2024年02月15日
    浏览(26)
  • systemctl start docker报错(code=exited, status=1/FAILURE)

    运行 systemctl start docker 报错内容如下: 输入 systemctl status docker.service 显示以下内容: 本次启动不起来与docker服务无关 具体解决问题是修改 /etc/docker/daemon.json, vim /etc/docker/daemon.json docker服务启动不起来,需要添加存储驱动 “storage-driver”: “overlay2”, “storage-opts”: [“overla

    2024年04月14日
    浏览(34)
  • centOS7 Mysql启动失败报错Job for mysqld.service failed because the control process exited with error code.

    在CentOS7中安装部署MySQL服务,首次启动服务时失败报错 Job for mysqld.service failed because the control process exited with error code.See “systemctl status mysqld.service” and “journal -xe” for details. 引起此报错的原因不尽相同,所以建议先找到引起报错的具体原因再针对性寻找解决方案 报错信息告

    2024年02月07日
    浏览(35)
  • android服务启动失败Unable to start service Intent U=0: not found

    android启动服务失败,提示:Unable to start service Intent { cmp=xxx/.xxx} U=0: not found。检查清单文件服务配置没有错,启动服务的方法也没错。 场景:我的程序是系统应用,运行于9.0,作为launcher使用,在application onCreate中启动服务。试过延迟启动服务和配置action和Package的方式启动服

    2024年02月11日
    浏览(36)
  • Failed to start mysqld.service: Unit not found.

    请仔细观看文档后,如果符合这个错误,再通过这种方式解决,不要盲目复制 问题 :Failed to start mysqld.service: Unit not found. 原因 :MySQL没有安装成功,就启动MySQL 如果是在使用\\\"yum -y install mysql-community-server\\\"命令安装mysql的时候,没有安装成功(原因:密钥已安装但是不适用此软

    2024年02月11日
    浏览(32)
  • LInux Mysql 启动时报错: Job for mysqld.service failed because the control process exited with err...解决方法

    1、启动mysql 报错 2、分析错误信息 3、解决方式 4、启动mysql服务

    2024年04月23日
    浏览(36)
  • Zookeeper启动失败:FAILED TO START解决方案

     如图,启动zookeeper失败,输入 查看失败原因  Invalid config,我得知是配置文件出了问题,但是检查配置文件没有发现错误 最终在配置文件末尾配置参数结尾发现了未删除的空格  将三个节点配置文件中的空格删去之后,zookeeper均能正常运行 至此问题解决,投身下一个问题中

    2024年02月12日
    浏览(32)
  • linux篇---使用systemctl start xxx启动自己的程序|开机启动|守护进程

    机器:Nvidia Jetson Xavier 系统:ubuntu 18.04 最近在使用symfony的console组件,需要执行一个后台的php进程,并且保持后台进程一直存在。这里我使用的是Systemctl命令。Systemctl是一个系统管理守护进程、工具和库的集合。后面我就直接把自己的配置贴出来,仅供参考: app.service的内容

    2024年02月11日
    浏览(30)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包