Windows 10 下mysql 安装后无法启动问题

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Windows 10 下mysql 安装后无法启动问题相关的知识,希望对你有一定的参考价值。

安装过程:

1. 官网下载5.15.7, http://dev.mysql.com/downloads/, 选择开源社区版:MySQL Community Server (GPL)

2. 我解压后放在 E:\mysql\5.7.15\ 下面

3. 将E:\mysql\5.7.15\bin加入系统path

4. 安装mysql服务: mysqld --install

5. 编辑E:\mysql\5.7.15\my.ini文件

# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. Its a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.

[mysqld]

basedir = E:/mysql/5.7.15
datadir = E:/mysql/data
port = 3306

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 

6. 用管理员身份打开cmd命令窗口

7. 初始化mysql: mysqld --initialize

8. 启动mysql服务: net start mysql

====================================================================

遇到的问题:

问题1: 

E:\mysql\5.7.15>net start mysql
MySQL 服务正在启动 .
MySQL 服务无法启动。

服务没有报告任何错误。

请键入 NET HELPMSG 3534 以获得更多的帮助。


E:\mysql\5.7.15>net helpmsg 3534

服务没有报告任何错误。

问题2: 

这个错误没有仍和日志记录,原因是my.ini中datadir所设定的目录不存在,路径分隔符需要采用linux格式“/”, 而不是“\"

如果mysql找不到这个data目录, 那么初始化会出错:

E:\mysql\5.7.15\bin>mysqld --initialize
mysqld: Cant create directory E:\myusql\data\ (Errcode: 2 - No such file or directory)
2016-09-16T07:52:37.476808Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-09-16T07:52:37.476808Z 0 [Warning] NO_ZERO_DATE, NO_ZERO_IN_DATE and ERROR_FOR_DIVISION_BY_ZERO sql modes should be used with strict mode. They will be merged with strict mode in a future release.
2016-09-16T07:52:37.476808Z 0 [Warning] NO_AUTO_CREATE_USER sql mode was not set.
2016-09-16T07:52:37.492808Z 0 [ERROR] Aborting

问题3: data目录非空,也会初始化也会出错:

E:\mysql\5.7.15\bin>mysqld --initialize
2016-09-16T07:53:33.306817Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-09-16T07:53:33.306817Z 0 [Warning] NO_ZERO_DATE, NO_ZERO_IN_DATE and ERROR_FOR_DIVISION_BY_ZERO sql modes should be used with strict mode. They will be merged with strict mode in a future release.
2016-09-16T07:53:33.306817Z 0 [Warning] NO_AUTO_CREATE_USER sql mode was not set.
2016-09-16T07:53:33.310106Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting.
2016-09-16T07:53:33.318664Z 0 [ERROR] Aborting

 

以上是关于Windows 10 下mysql 安装后无法启动问题的主要内容,如果未能解决你的问题,请参考以下文章

求教Win10下MYSQL服务不能启动的问题

求助Mariadb 配置集群后,无法启动

Windows安装Mysql后一段时间后Mysql服务无法启动的问题

Windows下Nginx的安装及启动

ArcGIS Server10.2安装完后ArcGIS Server服务启动不了是怎么回事

windows的mysql无法启动 服务没有报告任何错误