MySQL数据库无法启动的简单排错
一般来说有经验的管理员在部署操作系统时通常会将操作系统本身与应用软件分离,将两者安装在不同的磁盘或者分区中,并且会保证有一定的资源余量以满足后期长期运
一般来说有经验的管理员在部署操作系统时通常会将操作系统本身与应用软件分离,将两者安装在不同的磁盘或者分区中,并且会保证有一定的资源余量以满足后期长期运行的需要。但是在虚拟化环境中一般经常遭遇资源比较紧张、管理比较混乱的情况,特别是资源浪费非常严重,往往是资源分配不均、最初对物理服务器测量不准确导致的。不管是什么原因,只有拿出时间去及时的清理、解决问题就是一种良性运维,否则日后虚拟机累积成几百个就非常麻烦了,特别是模板出现问题就非常严重。
数据库系统往往是要求最苛刻的应用,不仅对CPU内存要求苛刻(特别是内存),,对硬盘速度(I/O)和大小都有较为苛刻的要求。在部署MySQL数据库时分配较大的内存较大较快的硬盘是值得的,至少要对my.cnf文件进行仔细的配置才行。当然了最好还是对物理服务器进行有效的评估,先制定一个满足运行条件的脚本系统配置,优化后再统计一段相当长时间的运行情况,CPU、内存、硬盘和网络的压力是怎么样分布的,峰值时间集中在哪一个阶段,再结合日志分析后再得出一个比较准确的配置和优化结果。
从MySQL数据库的配置文件/etc/my.cnf种找到日志存在的位置,确定无误后删除错误日志。
[root@zabbixserver ~]# rm -rf /var/log/mysqld.log
重新启动一次MySQL数据库,观察错误日志。
[root@zabbixserver ~]# service mysqld start
MySQL Daemon failed to start.
Starting mysqld: [FAILED]
[root@zabbixserver ~]# cat /var/log/mysqld.log
140505 11:22:52 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
140505 11:22:52 InnoDB: Initializing buffer pool, size = 8.0M
140505 11:22:52 InnoDB: Completed initialization of buffer pool
InnoDB: Log scan progressed past the checkpoint lsn 2 2955725186
140505 11:22:52 InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
InnoDB: Doing recovery: scanned up to log sequence number 2 2955745512
InnoDB: 1 transaction(s) which must be rolled back or cleaned up
InnoDB: in total 4 row operations to undo
InnoDB: Trx id counter is 0 43004160
140505 11:22:52 InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progress in percents: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
InnoDB: Apply batch completed
InnoDB: Last MySQL binlog file position 0 1735848, file name ./mysql-bin.000018
InnoDB: Starting in background the rollback of uncommitted transactions
140505 11:22:52 InnoDB: Rolling back trx with id 0 41354738, 4 rows to undo
140505 11:22:52 InnoDB: Started; log sequence number 2 2955745512
140505 11:22:52 [Note] Recovering after a crash using mysql-bin
140505 11:22:52 [ERROR] Error in Log_event::read_log_event(): 'read error', data_len: 990, event_type: 24
140505 11:22:52 [Note] Starting crash recovery...
140505 11:22:52 [Note] Crash recovery finished.
03:22:52 UTC - mysqld got signal 11 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help
diagnose the problem, but since we have already crashed,
something is definitely wrong and this may fail.
key_buffer_size=8384512
read_buffer_size=131072
max_used_connections=0
max_threads=700
thread_count=0
connection_count=0
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 1538661 K bytes of memory
Hope that's ok; if not, decrease some variables in the equation.
Thread pointer: 0x0
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 0 thread_stack 0x40000
/usr/libexec/mysqld(my_print_stacktrace+0x29) [0x84f539]
/usr/libexec/mysqld(handle_fatal_signal+0x483) [0x6a3713]
/lib64/libpthread.so.0(+0xf500) [0x7ff1f5519500]
The manual page at contains
information that should help you find out what is causing the crash.
140505 11:22:52 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
[root@zabbixserver ~]# grep error /var/log/mysqld.log
140505 11:22:52 [ERROR] Error in Log_event::read_log_event(): 'read error', data_len: 990, event_type: 24
or misconfigured. This error can also be caused by malfunctioning hardware.
根据经验先看看磁盘空间够不够用,果不其然。如果着急只能将二进制日志停掉先将服务启动再说,如果不着急那就只能扩容或者迁移到大硬盘上去了。当然了MySQL Cluster以及主从之类的需要额外处理。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











MySQL and phpMyAdmin are powerful database management tools. 1) MySQL is used to create databases and tables, and to execute DML and SQL queries. 2) phpMyAdmin provides an intuitive interface for database management, table structure management, data operations and user permission management.

Compared with other programming languages, MySQL is mainly used to store and manage data, while other languages such as Python, Java, and C are used for logical processing and application development. MySQL is known for its high performance, scalability and cross-platform support, suitable for data management needs, while other languages have advantages in their respective fields such as data analytics, enterprise applications, and system programming.

Oracle is not only a database company, but also a leader in cloud computing and ERP systems. 1. Oracle provides comprehensive solutions from database to cloud services and ERP systems. 2. OracleCloud challenges AWS and Azure, providing IaaS, PaaS and SaaS services. 3. Oracle's ERP systems such as E-BusinessSuite and FusionApplications help enterprises optimize operations.

In MySQL, the function of foreign keys is to establish the relationship between tables and ensure the consistency and integrity of the data. Foreign keys maintain the effectiveness of data through reference integrity checks and cascading operations. Pay attention to performance optimization and avoid common errors when using them.

The main difference between MySQL and MariaDB is performance, functionality and license: 1. MySQL is developed by Oracle, and MariaDB is its fork. 2. MariaDB may perform better in high load environments. 3.MariaDB provides more storage engines and functions. 4.MySQL adopts a dual license, and MariaDB is completely open source. The existing infrastructure, performance requirements, functional requirements and license costs should be taken into account when choosing.

SQL is a standard language for managing relational databases, while MySQL is a database management system that uses SQL. SQL defines ways to interact with a database, including CRUD operations, while MySQL implements the SQL standard and provides additional features such as stored procedures and triggers.

Safely handle functions and regular expressions in JSON In front-end development, JavaScript is often required...

Redis is a memory data structure storage system, mainly used as a database, cache and message broker. Its core features include single-threaded model, I/O multiplexing, persistence mechanism, replication and clustering functions. Redis is commonly used in practical applications for caching, session storage, and message queues. It can significantly improve its performance by selecting the right data structure, using pipelines and transactions, and monitoring and tuning.
