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. It's 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.
datadir = E:/mysql/data
port = sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

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

7. 初始化mysql: mysqld --initialize

8. 启动mysql服务: net start mysql

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

遇到的问题:

问题1:

E:\mysql\5.7.>net start mysql
MySQL 服务正在启动 .
MySQL 服务无法启动。 服务没有报告任何错误。 请键入 NET HELPMSG 以获得更多的帮助。 E:\mysql\5.7.>net helpmsg 服务没有报告任何错误。

问题2:

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

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

E:\mysql\5.7.\bin>mysqld --initialize
mysqld: Can't create directory 'E:\myusql\data\' (Errcode: 2 - No such file or directory)
--16T07::.476808Z [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
--16T07::.476808Z [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.
--16T07::.476808Z [Warning] 'NO_AUTO_CREATE_USER' sql mode was not set.
--16T07::.492808Z [ERROR] Aborting

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

E:\mysql\5.7.\bin>mysqld --initialize
--16T07::.306817Z [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
--16T07::.306817Z [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.
--16T07::.306817Z [Warning] 'NO_AUTO_CREATE_USER' sql mode was not set.
--16T07::.310106Z [ERROR] --initialize specified but the data directory has files in it. Aborting.
--16T07::.318664Z [ERROR] Aborting
上一篇:2g-3g


下一篇:JAVA_jdk下载和环境变量的配置