Windows 10 Install MySQL Community Server

下载

下载页面:https://dev.mysql.com/downloads/mysql/

本文使用的版本下载链接:

https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.20-winx64.zip

安装

  1. 将下载的zip文件解压到指定的路径,如:D:\Softwares\mysql-5.7.20-winx64,以下以 [MYSQL_DIR] 代替。

    1
    cd [MYSQL_DIR]/bin
  2. 初始化

    1
    > mysqld --initialize --user mysql --console

    执行成功后会生成一个临时密码:

    A temporary password is generated for root@localhost: WjdKaOdBt5+0

  3. 安装

    1
    > mysqld -install

    Service successfully installed.

  4. 启动服务

    1
    > net start mysql

    MySQL 服务正在启动.

    MySQL 服务已经启动成功.

验证

  1. 登录

    1
    > mysql -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.20

  2. 修改密码

    1
    mysql> alter user root@localhost identified by "root";

    Query OK, 0 rows affected (0.00 sec)

(完)