- 下载zip文件
- 使用管理者身份进入C:\WINDOWS\system32>cd C:\Program Files (x86)\mysql-5.7.22-winx64\bin目录下
- 执行mysqld --initialize --user=mysql --console
-
记录随机密码: A temporary password is generated for root@localhost: ZzgPa8K!=Xwk
- C:\Program Files (x86)\mysql-5.7.22-winx64\bin>mysqld -install mysql
Service successfully installed.
6.C:\Program Files (x86)\mysql-5.7.22-winx64\bin>net start mysql
mysql 服务正在启动 .
mysql 服务已经启动成功。
7.C:\Program Files (x86)\mysql-5.7.22-winx64\bin>mysql -uroot -p
Enter password: ZzgPa8K!=Xwk此处为刚刚记录的随机密码
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.22
8.mysql> alter user 'root'@'localhost' identified by 'xxxxxx';(记得加分号=_=)
Query OK, 0 rows affected (0.00 sec)