報錯如下
參照別的博主的博客:
先 mysqld -remove移除,
再 mysqld --initialize
再 mysqld install
再 net start mysql
試了一遍失敗了,想了一下從安裝到現在到底哪裏出錯了,然後看到了這個博主的文章
https://blog.csdn.net/qq_28990603/article/details/80883497
所以我就改了一下我的my.ini的datadir目錄,直接設置了個data,沒用事先創建,再次運行上面的四個命令,就安裝成功了。
本來還以爲又要徹底刪除mysql,重新安裝了呢。
之前我這裏設置的是我自己創建的mydata,就一直報錯。至於爲什麼會自己創建的會報錯,我也狠奇怪,總之現在好了
貼一下我的my.ini
[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:\development\mysql-8.0.17-winx64
datadir = D:\development\mysql-8.0.17-winx64\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
character-set-server = utf8mb4
performance_schema_max_table_instances = 600
table_definition_cache = 400
table_open_cache = 256
[mysql]
default-character-set = utf8mb4
[client]
default-character-set = utf8mb4
安裝成功後,data文件夾下有這些文件
在data下面搜索 .err搜到的文件打開
第一個文件打開,就能看到A temporary password is generated,冒號後面就是初始密碼
後來的安裝過程參考了這個博主的博客:
https://blog.csdn.net/weixin_44414527/article/details/88894127
好了,大家知道爲什麼的可以評論告訴我,謝謝~