windows MySql 5.7.9,启动不了。缺少data

官网MySQL百度云链接

链接:http://pan.baidu.com/s/1i4XoTdr 密码:t5ic

上边是官网的MySQL,下载之后目录是这样的

这里写图片描述

这个时候我们不能盲目启动,我习惯复制my-default.ini文件,生成自己的my.ini文件,此步也可以不需要,但是配置文件里面的basedir 和 datadir要给加上。

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]

# 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:\\software\\mysql-5.7
 datadir = D:\\software\\mysql-5.7\\data
 port = 3306
# server_id = .....


# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M 

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 

主要是把basedir和datadir设置一下,而且没有data需要自己建一个data文件夹。

命令行执行: mysqld –initialize –user=mysql –console

这里写图片描述

执行完毕之后会生成一个密码,别弄丢了

然后安装mysql启动mysql服务即可

这里写图片描述

登录用上面说过的生成的零时密码,然后我们set一个新密码就行。

data文件夹会有一个后缀err的文件

这个文件就是用来看错的

这里写图片描述

就是在这个文件,我看到了我的错误,然后去解决的

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值