第一步:下载https://downloads.mysql.com/archives/community/
选择 Product Version 、Operating System:
选择64bIt 点击下载
第二步:管理员身份执行cmd
C:\Users\Administrator>e:
E:\>cd E:\mysql-5.7.35-winx64\bin
E:\mysql-5.7.35-winx64\bin>mysqld --install
The service already exists!
The current server installed: E:\mysql-5.7.35-winx64\bin\mysqld MySQL
第三步:打印出 临时密码 temporary password
E:\mysql-5.7.35-winx64\bin>mysqld --initialize --console
2022-04-12T02:31:50.812202Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2022-04-12T02:31:51.227577Z 0 [Warning] InnoDB: New log files created, LSN=45790
2022-04-12T02:31:51.291849Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2022-04-12T02:31:51.427224Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: b5cd1e53-ba08-11ec-a6f8-c85b76673a3f.
2022-04-12T02:31:51.434226Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2022-04-12T02:31:55.831085Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2 or higher.
2022-04-12T02:31:55.831554Z 0 [Warning] A deprecated TLS version TLSv1.1 is enabled. Please use TLSv1.2 or higher.
2022-04-12T02:31:55.833689Z 0 [Warning] CA certificate ca.pem is self signed.
2022-04-12T02:31:57.200167Z 1 [Note] A temporary password is generated for root@localhost: fEfnQTomx0.o
第四步:启动mysql
E:\mysql-5.7.35-winx64\bin>net start mysql
MySQL 服务正在启动 .
MySQL 服务已经启动成功。
第五步:输入登录命令
E:\mysql-5.7.35-winx64\bin>mysql -uroot -p
Enter password: ************
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.35 MySQL Community Server (GPL)
第六步:修改密码
mysql> use mysql;
Database changed
mysql> update mysql.user set authentication_string=password('root') where user='root';
Query OK, 1 row affected, 1 warning (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 1