WIN 10 安装 mysql-5.7.17

1、解压如下mysql安装包到指定路径
mysql-5.7.17-winx64.zip

2、修改mysql配置文件
解压目录下面找到配置文件
WIN 10 安装 mysql-5.7.17
修改my-default.ini配置文件为如下内容:
[mysql]
default-character-set=utf8

[mysqld]
basedir = C:\mysql-5.7.17-winx64
datadir = C:\mysql-5.7.17-winx64\data
port = 3306
server_id = 1111

character-set-server=utf8
default-storage-engine=INNODB

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 

3、安装mysql数据库
使用命令行工具进入到mysql bin 目录,执行 mysqld --install 命令安装数据库

PS C:\mysql-5.7.17-winx64\bin> .\mysqld.exe --install
Service successfully installed.

4、初始化数据库
执行 mysqld --initialize 命令初始化数据库,如下
PS C:\mysql-5.7.17-winx64\bin> .\mysqld.exe --initialize

5、启动数据库
PS C:\mysql-5.7.17-winx64\bin> net start mysql
MySQL 服务正在启动 .
MySQL 服务已经启动成功。

6、从如下文件中找到初始化后生成的 root 临时密码
WIN 10 安装 mysql-5.7.17
WIN 10 安装 mysql-5.7.17

7、使用临时密码登录数据库修改为自己指定的密码并验证
PS C:\mysql-5.7.17-winx64\bin> .\mysql.exe -u root -p
Enter password: ************
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.17

Copyright (c) 2000, 2016, 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>
mysql> alter user root@localhost identified by 'root';
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> \q
Bye
PS C:\mysql-5.7.17-winx64\bin> .\mysql.exe -u root -p
Enter password: ****
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.17 MySQL Community Server (GPL)

Copyright (c) 2000, 2016, 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>
mysql>

到这里我们 mysql 的简单安装就已经完成。







上一篇:NS2机制


下一篇:Oracle 调优助手的简单用法