Edited at

Windows に MySQL 5.7 をインストールする

More than 1 year has passed since last update.

MySQLの Zip Archive からインストールする場合のメモ


ZIP Archive をダウンロードする

http://dev.mysql.com/downloads/mysql/ から Zip Archive をダウンロードする


ダウンロードした Zip Archive を展開する

適当な場所に ダウンロードしたZip Archive を展開する。(例えば c:\mysql)


my.iniを作成する

以下のように c:\mysql\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
innodb_buffer_pool_size = 64M
innodb_file_per_table = 1
innodb-status-output = 0
innodb-status-output-locks = 0

default-storage-engine = innodb

# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
log_bin = mysql-bin

# These are commonly set, remove the # and set as required.
# basedir = .....
# datadir = .....
# port = .....
# server_id = .....
basedir = "c:/mysql"
datadir = "c:/mysql/data"
tmpdir = "c:/mysql/tmp"
port = 3306
server_id = 1

character-set-server = utf8
collation-server = utf8_general_ci

transaction-isolation = REPEATABLE-READ

# Logging
log_output = FILE
log_error_verbosity = 3
log_error = "c:/mysql/logs/mysqld_error.log"
general_log = 1
general_log_file = "c:/mysql/logs/general_query_all.log"
log-slow-admin-statements = 1
log-queries-not-using-indexes = 1
slow_query_log = 1
long_query_time = 1
slow_query_log_file = "c:/mysql/logs/slow_query.log"
log_syslog = 0
log_timestamps = SYSTEM

# 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 = ONLY_FULL_GROUP_BY,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

# autocommit = 0
explicit_defaults_for_timestamp = true

default_password_lifetime = 0
secure-file-priv = "C:/var/tmp"

[mysql]
default-character-set = utf8
show-warnings


初期化

以下のコマンドを実行して初期化する

mysqld --initialize-insecure --user=mysql


動作チェック

以下のコマンドを実行してサービスを起動し、動作チェックする。

mysqld --defaults-file="c:\mysql\my.ini" --console


サービスインストール

管理者権限で以下のコマンドを実行し、サービスとして起動できるようにする。

mysqld --install "MySQL 5.7.16"