- 下载 MySQL binaries for Windows x64 v8.0.12.zip
- 配置 my.ini (推荐使用 MySQL 配置编辑器 https://tools.percona.com/wizard 或者 http://imysql.com/my-cnf-wizard.html)。
- 命令行工具初始化数据目录 (安装根目录下)
cmd>cd "Installation Directory"
cmd>mysqld --initialize-insecure
- 命令行注册 MySQL 为服务 (bin 目录下)
cmd>cd "bin"
cmd>mysqld install "ServiceName (for example: MySQL8)"
cmd>net start MySQL8
- 修改 root 用户密码 (bin 目录下)
cmd>mysqladmin -u root (-p 旧密码<如果有>) password "新密码"
- 重新启动 MySQL 服务
cmd>net stop MySQL8
cmd>net start MySQL8
- 测试连接
cmd>cd bin
cmd>mysql -u root -p
mysql>Enter your password:"新密码"
测试成功的 my.ini 配置文件
分享码: 6xi5
MySQL Configuration File Examples
# Generated by Percona Configuration Wizard (http://tools.percona.com/) version REL5-20120208
# Configuration name server-20180826 generated for 180261899@QQ.COM at 2018-08-16 13:50:48
[mysql]
# CLIENT #
port = 3306
socket = D:\Data\MySQL\mysql.sock
# default-character-set = utf8
[mysqld]
# GENERAL #
user = mysql
default-storage-engine = InnoDB
socket = D:\Data\MySQL\mysql.sock
pid-file = D:\Data\MySQL\mysql.pid
character-set-server = utf8
lower_case_table_names = 2
# MyISAM #
key-buffer-size = 32M
myisam-recover-options = FORCE,BACKUP
# SAFETY #
max-allowed-packet = 16M
max-connect-errors = 1000000
# DATA STORAGE #
datadir = D:\Data\MySQL\
# BINARY LOGGING #
log-bin = D:\Data\MySQL\mysql-bin
expire-logs-days = 14
sync-binlog = 1
# CACHES AND LIMITS #
tmp-table-size = 32M
max-heap-table-size = 32M
# query-cache-type = 0
# query-cache-size = 0
max-connections = 500
thread-cache-size = 50
open-files-limit = 65535
table-definition-cache = 4096
table-open-cache = 4096
# INNODB #
innodb-log-files-in-group = 2
innodb-log-file-size = 256M
innodb-flush-log-at-trx-commit = 1
innodb-file-per-table = 1
innodb-buffer-pool-size = 6G
# LOGGING #
log-error = D:\Data\MySQL\mysql-error.log
log-queries-not-using-indexes = 1
slow-query-log = 1
slow-query-log-file = D:\Data\MySQL\mysql-slow.log
网友评论