1下载mysql http://dev.mysql.com/downloads/mysql/
2解压后,新建一个data文件夹,复制my-default.ini,并改名为my.ini,添加下面内容
[client]
default-character-set = utf8
[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
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
# These are commonly set, remove the # and set as required.
basedir = D:\Develop\mysql\mysql-5.7.15-winx64
datadir = D:\Develop\mysql\mysql-5.7.15-winx64\data
port = 3306
server_id = 62
character-set-server=utf8
collation-server=utf8_general_ci
default-storage-engine=INNODB
3在path添加mysql环境变量
4用管理员身份运行cmd,进进入mysqm的bin目录(一定要进入bin目录,否则后面安装会出错),运行下面命令
mysqld --initialize --user=mysql --console
命令运行完成后,最后会产生一个随机密码,这个就是原创密码,要记录下来
5安装mysql到windows服务
mysqld --install MySQL
6启动mysql服务
net start mysql
7登陆进入mysql后,修改mysql密码
SET PASSWORD = PASSWORD('123456');
flush privileges;