MySQL8.0 Windows zip包下载地址: https://dev.mysql.com/downloads/mysql/
选择合适免安装版MySQL安装包
解压至C盘下,将默认文件夹mysql-8.0.12-winx64更改为mysql
在其他盘中新建文件my.ini (可以先默认TXT,配置后更改文件名,移动至C盘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 = "c:\\mysql\\" //basedir表示MySQL软件的安装路径
datadir = "c:\\mysql\\data\\" //datadir 表示MySQL数据的文件
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 = 2
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
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
初始化数据库
在mysql/bin下执行命令 mysqld –initialize-insecure –console
执行完成后,会打印 root 用户的初始默认密码
执行 mysql --install运行MySQL服务
启动MySQL服务 net start mysql
执行mysql -u root -p登陆,不需要密码,直接回车
启动并测试