Mysql 5.7.22 install for
windows
一:下载
下载地址dev.mysql.com/downloads/mysql
安装包名称
mysql-5.7.22-winx64.zip
二:解压mysql-5.7.22-winx64.zip
三:my.ini
D:\mysql\mysql-5.7.22-winx64目录下新建my.ini文件,内容如下:
[mysql]
#设置mysql客户端默认字符集
default-character-set=utf8
[mysqld]
#设置3306端口
port = 3306
#设置mysql的安装目录
basedir=D:\mysql\mysql-5.7.22-winx64
#设置mysql数据库的数据的存放目录
datadir=D:\mysql\mysql-5.7.22-winx64\data
#允许最大连接数
max_connections=200
#服务端使用的字符集默认为8比特编码的latin1字符集
character-set-server=utf8
#创建新表时将使用的默认存储引擎
default-storage-engine=INNODB
四:初始化
D:\mysql\mysql-5.7.22-winx64\bin>mysqld --initialize --user=mysql --console
2018-06-20T07:48:39.780714Z 0 [Warning]
TIMESTAMP with implicit DEFAULT value is
deprecated. Please use
--explicit_defaults_for_timestamp server option (see doc
umentation for more details).
2018-06-20T07:48:41.244714Z 0 [Warning]
InnoDB: New log files created, LSN=45790
2018-06-20T07:48:41.749714Z 0 [Warning]
InnoDB: Creating foreign key constraint
system tables.
2018-06-20T07:48:41.891714Z 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:
59e7dc2e-745e-11e8-ae3b-2c6fc91b2aca.
2018-06-20T07:48:41.939714Z 0 [Warning]
Gtid table is not ready to be used. Tabl
e 'mysql.gtid_executed' cannot be opened.
2018-06-20T07:48:41.965714Z 1 [Note] A
temporary password is generated for root@
localhost:4p?LswtPSJqh
五:安装服务
D:\mysql\mysql-5.7.22-winx64\bin>mysqld -install
Service successfully installed.
六:启动服务
D:\mysql\mysql-5.7.22-winx64\bin>net start
mysql
MySQL服务正在启动.
MySQL服务已经启动成功。
七:登陆数据库
D:\mysql\mysql-5.7.22-winx64\bin>mysql
-uroot -p"4p?LswtPSJqh"
mysql: [Warning] Using a password on the
command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.22
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> show databases;
ERROR 1820 (HY000): You must reset your
password using ALTER USER statement befo
re executing this statement.
---修改密码
mysql>alter user 'root'@'localhost' identified by '123';
Query OK, 0 rows affected (0.00 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.00 sec)