Mysql 启动报1067错误

今天一个项目需要用到mysql,因为公司领用的新电脑还没安装,就下载了一个解压版的5.6.29版本。

mysql的安装配置本身就已经很简单了。

解压到本地(我解压的是d:\tools),复制my-default.ini文件为my.ini,修改里面的配置如下:

[mysqld]

# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M

# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin

# These are commonly set, remove the # and set as required.
basedir=D:\tools\mysql
datadir=D:\tools\mysql\data
# port=3306
# server_id = mysql

然后以管理员执行bin目录下的服务安装命令:

mysqld -install

 系统提示服务安装成功。

D:\tools\mysql\bin>mysqld -install
Service successfully installed.

接着,启动服务,但是系统提示,启动失败,1067错误

D:\tools\mysql\bin>net start mysql
MySQL 服务正在启动 ...
MySQL 服务无法启动。

系统出错。

发生系统错误 1067。

进程意外终止。

网上查找了一下,1067错误是指配置文件错误。网上也列举了一些解决办法:

1.确定一下my.ini文件的位置,包括window目录下、安装目录下等;  --未尝试

2.增加配置                                                                                          --未尝试,我的mysql没有这个文件

[WinMySQLadmin]

Server=C:/Program Files/mysql/bin/mysqld-nt.exe

3.修改配置为“default-storage-engine=MyISAM”                                --未尝试

4.重装mysql                                                                                       --未尝试

5.重装系统                                                                                         --未尝试

6.修改my.ini文件为ANSI(说这个文件不能为UTF-8)                       --尝试,无效

最后,在一个网友的帖子中似乎看到了一个解决的思路,就是去到系统日志中查看启动错误日志。

写道
Can't find messagefile 'D:\ ools\mysql\share\errmsg.sys'

For more information, see Help and Support Center at http://www.mysql.com.

 发现日志中的路径存在错误,问题找到了。应该是读取配置文件的代码将路径中的反斜杠转义了,所以导致路径读取失败。

解决措施:修改my.ini文件中的路径配置,将反斜杠修改为正斜杠,启动mysql,成功。

配置文件:

shell 写道
[mysqld]

# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M

# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin

# These are commonly set, remove the # and set as required.
basedir=D:/tools/mysql
datadir=D:/tools/mysql/data
# port=3306
# server_id = mysql

启动mysql:

shell 写道
D:\tools\mysql\bin>net start mysql
MySQL 服务正在启动 .
MySQL 服务已经启动成功。

分析:

    官方提供的解压版,除非特别说明,在系统中应该不太可能依赖一定的配置或要求,比如增加配置项等,所以重装mysql或重装系统之类的操作尽量少试。记录在此,以防后面遇到相同的问题。

注:此分析只针对解压版,安装版可能会根据不同系统写入不同的内容,不在此讨论之列。

猜你喜欢

转载自wenhai.iteye.com/blog/2294062