C:\Windows\system32>D:
D:\>cd D:\Program Files\mysql-5.7.20-winx64\bin
D:\Program Files\mysql-5.7.20-winx64\bin>mysqld --initialize-insecure
D:\Program Files\mysql-5.7.20-winx64\bin>mysqld --install
Service successfully installed.
中间加上这一步!!!!!!!D:\Program Files\mysql-5.7.20-winx64\bin>mysqld --initialize-insecure --user=mysql
D:\Program Files\mysql-5.7.20-winx64\bin>net start mysql
MySQL 服务正在启动 .
MySQL 服务已经启动成功。
D:\Program Files\mysql-5.7.20-winx64\bin>mysqladmin -u root password 123456
mysqladmin: [Warning] Using a password onthe command line interface can be insecure.
Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety.
D:\Program Files\mysql-5.7.20-winx64\bin>mysql -u root -p
Enter password: ******
Welcome tothe MySQL monitor. Commands endwith ; or \g.
Your MySQL connection idis4
Server version: 5.7.20 MySQL Community Server (GPL)
Copyright (c) 2000, 2017, Oracle and/orits affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/orits
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> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+4 rows inset (0.00 sec)
mysql>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
还在命令模式下,将目录切换到自己的\bin目录下。
输入mysql -u root -p ,默认是没有密码的。回车进入,root是用户名,
5.2 初始化密码
在root用户登录mysql状态下,输入SET PASSWORD FOR root=PASSWORD('password');