create file mysql.ini in D:\mysql-5.7.13-winx64/
1.1.add D:\mysql-5.7.13-winx64/my.ini to windows env path
1.2.run cmd as administrator, then execute the cmd:
mysqld --initialize --user=mysql --console
2016-06-19T05:27:21.064947Z 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'E
RROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will
be merged with strict mode in a future release.
2016-06-19T05:27:21.568976Z 0 [Warning] InnoDB: New log files created, LSN=45790
2016-06-19T05:27:21.912995Z 0 [Warning] InnoDB: Creating foreign key constraint
system tables.
2016-06-19T05:27:21.966998Z 0 [Warning] No existing UUID has been found, so we a
ssume that this is the first time that this server has been started. Generating
a new UUID: 7f82d6f5-35de-11e6-ad6e-1418774d10c9.
2016-06-19T05:27:21.980999Z 0 [Warning] Gtid table is not ready to be used. Tabl
e 'mysql.gtid_executed' cannot be opened.
2016-06-19T05:27:21.989000Z 1 [Note] A temporary password is generated for root@
localhost: /:3pi3.dJUEJ
1.3.install as a windows service
mysqld install MySQL --defaults-file="D:\mysql-5.7.13-winx64/my.ini"
1.4.login mysql as root
mysql -u root -p
/:3pi3.dJUEJ
1.5.change root password
set password for root@localhost = password('P@ssword');
mysql.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]
port=3306
basedir="D:/mysql-5.7.13-winx64/"
datadir="D:/mysql-5.7.13-winx64/data/"
tmpdir="D:/mysql-5.7.13-winx64/data/"
socket = "D:/mysql-5.7.13-winx64/data/mysql.sock"
log-error="D:/mysql-5.7.13-winx64/data/mysql_error.log"
character-set-server=utf8mb4
#server_id = 2
#skip-locking
max_connections=100
query_cache_size=8M
table_open_cache=256
query_cache_size=8M
tmp_table_size=8M
thread_cache_size=8
innodb_data_home_dir="D:/mysql-5.7.13-winx64/data/"
innodb_flush_log_at_trx_commit =1
innodb_log_buffer_size=8M
innodb_buffer_pool_size=8M
innodb_log_file_size=8M
innodb_thread_concurrency=16
join_buffer_size = 8M
sort_buffer_size = 8M
read_rnd_buffer_size = 8M
max_allowed_packet = 32M
explicit_defaults_for_timestamp=true
sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
#sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
[client]
default-character-set=utf8mb4
[mysql]
default-character-set=utf8mb4