reading:http://dev.mysql.com/doc/refman/5.7/en/windows-create-option-file.html

1.cp my.default.ini as my.ini and modify options

[mysqld]
# set basedir to your installation path
basedir=E:/mysql
# set datadir to the location of your data directory
datadir=E:/mydata/data
or
[mysqld]
# set basedir to your installation path
basedir=E:\\mysql
# set datadir to the location of your data directory
datadir=E:\\mydata\\data

2.initialize msyqld in mysql bin folder

mysql\bin> mysqld.exe  --initialize [or --initialize-insecure]

3.print console infomation,it's can generate rand password.

mysql\bin> mysqld.exe --console

4.modify default password

For each account, ALTER USER expires its password. For example:

mysql > ALTER USER 'jeffrey'@'localhost' PASSWORD EXPIRE;
or
mysql > SET PASSWORD = PASSWORD('new_password');