1.官网下载文件

    2.解压放到你要安装的目录下

    3.cmd 管理员模式打开,切换到bin目录下

    1. D:\mysql-8.0.19-winx64\bin>mysqld --install
    2. Service successfully installed.
    3. D:\mysql-8.0.19-winx64\bin>

      1. mysqld --defaults-file="D:\mysql-8.0.20-winx64\bin\my.ini" --console --skip-grant-tables
    1. D:\mysql-8.0.20-winx64\bin>mysqld --initialize >>>会在data 路径下.err文件下生成随机密码
    2. D:\mysql-8.0.20-winx64\bin>mysqld --install
    3. Service successfully installed.
    4. D:\mysql-8.0.20-winx64\bin>net start mysql
    5. MySQL 服务正在启动 .
    6. MySQL 服务已经启动成功。
    7. D:\mysql-8.0.20-winx64\bin>mysql -u root -p
    8. Enter password: ************ 》》》在.err文件下生成随机密码中zhao
    9. Welcome to the MySQL monitor. Commands end with ; or \g.
    10. Your MySQL connection id is 8
    11. Server version: 8.0.20
    12. Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
    13. Oracle is a registered trademark of Oracle Corporation and/or its
    14. affiliates. Other names may be trademarks of their respective
    15. owners.
    16. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    17. mysql>
    18. >>>>修改密码,注意‘:’
    19. mysql> alter user user() identified by "你的密码";》》》我的是123456
    20. Query OK, 0 rows affected (0.06 sec)
    21. mysql>