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

来源:互联网 发布:php微商城 编辑:程序博客网 时间:2024/04/29 09:01

官网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的文件

这个文件就是用来看错的

这里写图片描述

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

0 0
原创粉丝点击