下载MySQL community 8.0.12 zip 版本并配置
(1) 下载 mysql-8.0.12-win64.zip
解压缩到某个文件夹, 比如 U 盘 F:\programs\mysql-8.0.12-winx64
一般没有 data 这个文件夹, 也没有 my-default.ini 这个文件.
新建一个 my.ini 文件, 或者从其他地方拷贝一个 my-default.ini 文件到当前目录 (F:\programs\mysql-8.0.12-winx64) 然后改名为 my.ini
my.ini 的内容为:
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/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 = F:/programs/mysql-8.0.12-winx64
datadir = F:/programs/mysql-8.0.12-winx64/data
port = 3306
# server_id = .....
bind-address = 127.0.0.1
# 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
显然拷贝自 mysql 5.6 版本.
(2)以管理员身份打开命令提示符( cmd 命令行窗口)
执行下面的命令:
mysqld --initialize-insecure
这将自动生成无密码的 root 用户.
然后执行
mysqld --install
net start mysql
References:
https://blog.csdn.net/liuwenbiao1203/article/details/53243487