一、环境描述
操作系统:windows 2012
数据库:mysql 5.7.12 企业版

二、操作步骤
1、规划
MySQL安装文件存放在D:\mysql,数据目录为E:mysqldata
2、配置文件位置为d:\mysql\my.ini  内容如下:
[mysqld]  
port = 3306  
basedir= D:\mysql
datadir= E:\mysqldata
max_connections=500  
character-set-server=utf8  
default-storage-engine=INNODB  
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES  
[mysql]  
default-character-set=utf8


3、安装服务
C:\Users\admin>d:
D:\>cd mysql\bin
D:\mysql\bin>.\mysqld -install 
4、初始化mysql
.\mysqld --initialize-insecure --user=mysql
5、启动服务
D:\mysql\bin>net start mysql
MySQL 服务正在启动 .
MySQL 服务已经启动成功。
6、登陆数据库
D:\mysql\bin>mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.22 MySQL Community Server (GPL)

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>
7、修改密码
use mysql;
update mysql.user set authentication_string=password('qwe12345') where user='root' and Host ='localhost';
flush privileges;
8、关闭服务
D:\mysql\bin>net stop mysql
MySQL 服务正在停止.
MySQL 服务已成功停止。