win+r→cmd
Microsoft Windows [版本 10.0.16299.251]
(c) 2017 Microsoft Corporation。保留所有权利。
C:UsersAdministrator>d:
D:>cd D:mysql-8.0.15-winx64in
D:mysql-8.0.15-winx64in>mysqld --install
The service already exists!
The current server installed: D:mysql-8.0.15-winx64inmysqld MySQL
D:mysql-8.0.15-winx64in>mysqld --remove
Service successfully removed.
D:mysql-8.0.15-winx64in>mysqld --install(注册服务)
Service successfully installed.
D:mysql-8.0.15-winx64in>mysqld --initialize --console(初始化,生成data文件)
2019-06-13T06:40:54.291090Z 0 [System] [MY-013169] [Server] D:mysql-8.0.15-winx64inmysqld.exe (mysqld 8.0.15) initializing of server in progress as process 6344
2019-06-13T06:40:54.293088Z 0 [Warning] [MY-013242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
2019-06-13T06:40:58.528810Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: KFS#??AGw5qd(默认密码)
2019-06-13T06:41:00.079587Z 0 [System] [MY-013170] [Server] D:mysql-8.0.15-winx64inmysqld.exe (mysqld 8.0.15) initializing of server has completed
D:mysql-8.0.15-winx64in>net start mysql
MySQL 服务正在启动 ..
MySQL 服务已经启动成功。
D:mysql-8.0.15-winx64in>mysql -u root -p
Enter password: ************(默认密码)
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 8
Server version: 8.0.15
Copyright (c) 2000, 2019, 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> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '1111111111111';(重置密码,这里我随便设置成‘1111111111‘,有了这条命令通常较低版本的navicat也可以链接MySQL)
Query OK, 0 rows affected (0.01 sec)
mysql> quit
Bye
D:mysql-8.0.15-winx64in>mysql -u root -p
Enter password: *********(自己设置的密码)
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 9
Server version: 8.0.15 MySQL Community Server - GPL
Copyright (c) 2000, 2019, 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>