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.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: Can't 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

 

posted on   大象O无形  阅读(5128)  评论(0编辑  收藏  举报

编辑推荐:
· Java 中堆内存和栈内存上的数据分布和特点
· 开发中对象命名的一点思考
· .NET Core内存结构体系(Windows环境)底层原理浅谈
· C# 深度学习:对抗生成网络(GAN)训练头像生成模型
· .NET 适配 HarmonyOS 进展
阅读排行:
· 手把手教你更优雅的享受 DeepSeek
· 腾讯元宝接入 DeepSeek R1 模型,支持深度思考 + 联网搜索,好用不卡机!
· AI工具推荐:领先的开源 AI 代码助手——Continue
· 探秘Transformer系列之(2)---总体架构
· V-Control:一个基于 .NET MAUI 的开箱即用的UI组件库

导航

< 2025年2月 >
26 27 28 29 30 31 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 1
2 3 4 5 6 7 8
点击右上角即可分享
微信分享提示