1.官网下载文件
2.解压放到你要安装的目录下
3.cmd 管理员模式打开,切换到bin目录下
D:\mysql-8.0.19-winx64\bin>mysqld --install
Service successfully installed.
D:\mysql-8.0.19-winx64\bin>
mysqld --defaults-file="D:\mysql-8.0.20-winx64\bin\my.ini" --console --skip-grant-tables
D:\mysql-8.0.20-winx64\bin>mysqld --initialize >>>会在data 路径下.err文件下生成随机密码
D:\mysql-8.0.20-winx64\bin>mysqld --install
Service successfully installed.
D:\mysql-8.0.20-winx64\bin>net start mysql
MySQL 服务正在启动 .
MySQL 服务已经启动成功。
D:\mysql-8.0.20-winx64\bin>mysql -u root -p
Enter password: ************ 》》》在.err文件下生成随机密码中zhao找
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.20
Copyright (c) 2000, 2020, 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 user() identified by "你的密码";》》》我的是123456
Query OK, 0 rows affected (0.06 sec)
mysql>