最近在使用mysql时,遇到了一个很棘手的问题,就是一直打不开mysql,每次尝试打开都会闪退。
我知道这是一个很常见的问题,但是我尝试了各种方法都没能解决它。在查找资料时,我发现该问题通常是由于mysql配置文件中的一些错误导致的。
# Example MySQL config file for very large systems.
#
# This file is read by MySQL server.
#
# Edit this file to suit your needs.
# This could be a lot faster if we didn't use DNS.
skip-name-resolve
# Compress all clientserver communication.
# Note: this will cause extra CPU usage on the server
# MySQL 4.1 and newer is needed for this.
# commented out by default
#compress
[mysqld]
# Set the buffer pool size as 64 MB
innodb_buffer_pool_size=64M
经过不懈的尝试后,我最终发现这个问题是由于我的配置文件中有一些语法错误所引起的。通过检查配置文件,我发现其中有几个属性被误写成了其它的选项。
我修改后的配置文件如下:
# Example MySQL config file for very large systems.
#
# This file is read by MySQL server.
#
# Edit this file to suit your needs.
# This could be a lot faster if we didn't use DNS.
skip-name-resolve
# Compress all clientserver communication.
# Note: this will cause extra CPU usage on the server
# MySQL 4.1 and newer is needed for this.
# commented out by default
#compress
[mysqld]
# Set the buffer pool size as 64 MB
innodb_buffer_pool_size = 64M
修改后,我重新尝试打开mysql,发现问题迎刃而解了。这启示我,即使是最简单的配置文件语法错误也会导致系统崩溃,所以一定要小心谨慎地编辑它们。