window 10下 MySql5.7压缩包安装
步骤如下:
1、
解压缩到某位置,
在其根目录下 新建data空目录,
新建my.ini,内容如下:
[mysql] default-character-set=utf8 [mysqld] port = 3306 basedir=D:\mysql-5.7.18-winx64 datadir=D:\mysql-5.7.18-winx64\data max_connections=200 character-set-server=utf8 default-storage-engine=INNODB
结构如图:
2、
配置环境变量,key为MYSQL_HOME,值为D:\mysql-5.7.18-winx64;path下新增字符串:%MYSQL_HOME%\bin
如图:
3、
管理员身份打开cmd,进入
D:\mysql-5.7.18-winx64\bin
目录下,
执行以下命令
D:\mysql-5.7.18-winx64\bin>mysqld install Service successfully installed. D:\mysql-5.7.18-winx64\bin>mysqld --initialize --user=mysql --console 2017-07-03T13:29:47.992396Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2017-07-03T13:29:49.186574Z 0 [Warning] InnoDB: New log files created, LSN=45790 2017-07-03T13:29:49.586778Z 0 [Warning] InnoDB: Creating foreign key constraint system tables. 2017-07-03T13:29:49.805224Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: b053a390-5ff3-11e7-8f93-408d5cc8a659. 2017-07-03T13:29:49.865407Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened. 2017-07-03T13:29:50.048867Z 1 [Note] A temporary password is generated for root@localhost: ,Qhlh:z7?dQ5
//上边这句会在data下创建很多东西,并且给你创建一个root密码,从 逗号 到 5 这个字符串复制下来,这个就是你的密码,下边马上用到
D:\mysql-5.7.18-winx64\bin>net start mysql MySQL 服务正在启动 . MySQL 服务已经启动成功。 D:\mysql-5.7.18-winx64\bin>mysql -uroot -p Enter password: ************ Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 7 Server version: 5.7.18 Copyright (c) 2000, 2017, 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> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('qw12.,mn'); Query OK, 0 rows affected, 1 warning (0.00 sec) mysql> exit Bye