导致mysqld无法启动的一个错误问题及解决
来源:脚本之家
时间:2023-02-25 09:45:38 309浏览 收藏
各位小伙伴们,大家好呀!看看今天我又给各位带来了什么文章?本文标题是《导致mysqld无法启动的一个错误问题及解决》,很明显是关于数据库的文章哈哈哈,其中内容主要会涉及到错误、mysqld无法启动等等,如果能帮到你,觉得很不错的话,欢迎各位多多点评和分享!
导致mysqld无法启动的一个错误
由于不小心删除了 /var/log/mysql/ 这个目录(这是mysql服务器用来保存log的地方),导致无法启动mysqld。
在终端输入 service mysql start 回车,输出:
Job for mysql.service failed because the control process exited with error code.
See "systemctl status mysql.service" and "journalctl -xe" for details.
于是在终端输入 mysqld 回车,输出:
2020-12-24T06:29:14.144840Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2020-12-24T06:29:14.146597Z 0 [Note] mysqld (mysqld 5.7.31-0ubuntu0.18.04.1) starting as process 2760 ...
2020-12-24T06:29:14.151841Z 0 [ERROR] Could not open file '/var/log/mysql/error.log' for error logging: Permission denied
2020-12-24T06:29:14.151990Z 0 [ERROR] Aborting
2020-12-24T06:29:14.152063Z 0 [Note] Binlog end
2020-12-24T06:29:14.152108Z 0 [Note] mysqld: Shutdown complete
从提示看,是无法创建error.log,于是创建/var/log/mysql,再执行 ls -l /var/log 发现mysql这个目录的用户权限和组权限都是root,这就是问题所在,需要将其都改为mysql(使用chmod和chown命令)。
mysql 启动报错问题
MySQL 启动时报错
[root@yyfwq2 bin]# service mysql start
Starting MySQL....The server quit without updating PID file (/app/data//mysqldb.pid).[FAILED]
检查日志
[root@yyfwq2 log]# cat error.log
2017-11-21T11:42:15.698749Z 0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled
2017-11-21T11:42:15.698941Z 0 [Note] /app/mysql/bin/mysqld (mysqld 5.7.18-log) starting as process 7838 ...
2017-11-21T11:42:15.710334Z 0 [Note] InnoDB: PUNCH HOLE support not available
2017-11-21T11:42:15.710380Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-11-21T11:42:15.710389Z 0 [Note] InnoDB: Uses event mutexes
2017-11-21T11:42:15.710397Z 0 [Note] InnoDB: GCC builtin __sync_synchronize() is used for memory barrier
2017-11-21T11:42:15.710404Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
2017-11-21T11:42:15.710412Z 0 [Note] InnoDB: Using Linux native AIO
2017-11-21T11:42:15.710979Z 0 [Note] InnoDB: Number of pools: 1
2017-11-21T11:42:15.711154Z 0 [Note] InnoDB: Using CPU crc32 instructions
2017-11-21T11:42:15.716819Z 0 [Note] InnoDB: Initializing buffer pool, total size = 10G, instances = 8, chunk size = 128M
2017-11-21T11:42:16.845646Z 0 [Note] InnoDB: Completed initialization of buffer pool
2017-11-21T11:42:16.961424Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2017-11-21T11:42:16.961647Z 0 [ERROR] InnoDB: The Auto-extending innodb_system data file './ibdata1' is of a different size 768 pages (rounded down to MB) than specified in the .cnf file: initial 65536 pages, max 0 (relevant if non-zero) pages!
2017-11-21T11:42:16.961676Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2017-11-21T11:42:17.562477Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2017-11-21T11:42:17.562498Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2017-11-21T11:42:17.562511Z 0 [ERROR] Failed to initialize plugins.
2017-11-21T11:42:17.562518Z 0 [ERROR] Aborting
2017-11-21T11:42:17.562536Z 0 [Note] Binlog end
2017-11-21T11:42:17.562673Z 0 [Note] Shutting down plugin 'CSV'
2017-11-21T11:42:17.563197Z 0 [Note] /app/mysql/bin/mysqld: Shutdown complete
2017-11-21T11:46:34.437631Z 0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled
2017-11-21T11:46:34.437786Z 0 [Note] /app/mysql/bin/mysqld (mysqld 5.7.18-log) starting as process 9427 ...
2017-11-21T11:46:34.446814Z 0 [Note] InnoDB: PUNCH HOLE support not available
2017-11-21T11:46:34.446875Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-11-21T11:46:34.446886Z 0 [Note] InnoDB: Uses event mutexes
2017-11-21T11:46:34.446894Z 0 [Note] InnoDB: GCC builtin __sync_synchronize() is used for memory barrier
2017-11-21T11:46:34.446902Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
2017-11-21T11:46:34.446910Z 0 [Note] InnoDB: Using Linux native AIO
2017-11-21T11:46:34.447429Z 0 [Note] InnoDB: Number of pools: 1
2017-11-21T11:46:34.447594Z 0 [Note] InnoDB: Using CPU crc32 instructions
2017-11-21T11:46:34.451429Z 0 [Note] InnoDB: Initializing buffer pool, total size = 10G, instances = 8, chunk size = 128M
2017-11-21T11:46:35.561606Z 0 [Note] InnoDB: Completed initialization of buffer pool
2017-11-21T11:46:35.666054Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2017-11-21T11:46:35.666901Z 0 [ERROR] InnoDB: The Auto-extending innodb_system data file './ibdata1' is of a different size 768 pages (rounded down to MB) than specified in the .cnf file: initial 65536 pages, max 0 (relevant if non-zero) pages!
2017-11-21T11:46:35.666932Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2017-11-21T11:46:36.267707Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2017-11-21T11:46:36.267729Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2017-11-21T11:46:36.267742Z 0 [ERROR] Failed to initialize plugins.
2017-11-21T11:46:36.267750Z 0 [ERROR] Aborting
2017-11-21T11:46:36.267768Z 0 [Note] Binlog end
2017-11-21T11:46:36.267919Z 0 [Note] Shutting down plugin 'CSV'
2017-11-21T11:46:36.268430Z 0 [Note] /app/mysql/bin/mysqld: Shutdown complete
删除:ibdata1、ib_logfile0、ib_logfile1 后启动正常
[root@yyfwq2 data]# rm -rf ibdata1 ib_logfile0 ib_logfile1 [root@yyfwq2 data]# service mysql start Starting MySQL..............................................................................................................[ OK ]
分析其原因:
数据在初始化是分配了ibdata1的大小。我在my.cnf中重新设置了innodb_data_file_path = ibdata1:1G:autoextend 导致启动时报错。
总结
以上为个人经验,希望能给大家一个参考,也希望大家多多支持golang学习网。
今天带大家了解了错误、mysqld无法启动的相关知识,希望对你有所帮助;关于数据库的技术知识我们会一点点深入介绍,欢迎大家关注golang学习网公众号,一起学习编程~
-
188 收藏
-
119 收藏
-
100 收藏
-
307 收藏
-
172 收藏
-
475 收藏
-
266 收藏
-
273 收藏
-
283 收藏
-
210 收藏
-
371 收藏
-
- 前端进阶之JavaScript设计模式
- 设计模式是开发人员在软件开发过程中面临一般问题时的解决方案,代表了最佳的实践。本课程的主打内容包括JS常见设计模式以及具体应用场景,打造一站式知识长龙服务,适合有JS基础的同学学习。
- 立即学习 542次学习
-
- GO语言核心编程课程
- 本课程采用真实案例,全面具体可落地,从理论到实践,一步一步将GO核心编程技术、编程思想、底层实现融会贯通,使学习者贴近时代脉搏,做IT互联网时代的弄潮儿。
- 立即学习 507次学习
-
- 简单聊聊mysql8与网络通信
- 如有问题加微信:Le-studyg;在课程中,我们将首先介绍MySQL8的新特性,包括性能优化、安全增强、新数据类型等,帮助学生快速熟悉MySQL8的最新功能。接着,我们将深入解析MySQL的网络通信机制,包括协议、连接管理、数据传输等,让
- 立即学习 497次学习
-
- JavaScript正则表达式基础与实战
- 在任何一门编程语言中,正则表达式,都是一项重要的知识,它提供了高效的字符串匹配与捕获机制,可以极大的简化程序设计。
- 立即学习 487次学习
-
- 从零制作响应式网站—Grid布局
- 本系列教程将展示从零制作一个假想的网络科技公司官网,分为导航,轮播,关于我们,成功案例,服务流程,团队介绍,数据部分,公司动态,底部信息等内容区块。网站整体采用CSSGrid布局,支持响应式,有流畅过渡和展现动画。
- 立即学习 484次学习