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

這個文件就是用來看錯的

這裏寫圖片描述

就是在這個文件,我看到了我的錯誤,然後去解決的

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章