下载文件后解压,配置文件所在目录到path后,输入以下命令进行配置
Microsoft Windows [版本 10.0.18362.535]
(c) 2019 Microsoft Corporation。保留所有权利。
C:\Windows\system32>cd d:
D:\
C:\Windows\system32>d:
D:\>cd mysql-8.0.18-winx64
D:\mysql-8.0.18-winx64>cd bin
D:\mysql-8.0.18-winx64\bin>mysqld -install
The service already exists!
The current server installed: D:\mysql-8.0.18-winx64\bin\mysqld MySQL
D:\mysql-8.0.18-winx64\bin>net start mysql
请求的服务已经启动。
请键入 NET HELPMSG 2182 以获得更多的帮助。
D:\mysql-8.0.18-winx64\bin>mysqld --initialize
D:\mysql-8.0.18-winx64\bin>mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 8.0.18 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> alter user 'root'@'%' identified with mysql_native_password by 'yourpassword';
Query OK, 0 rows affected (0.11 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.05 sec)
mysql> exit
Bye
D:\mysql-8.0.18-winx64\bin>mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
D:\mysql-8.0.18-winx64\bin>mysql -u root -p
Enter password: *********
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 14
Server version: 8.0.18 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> exit
Bye
来源:CSDN
作者:大神我来了
链接:https://blog.csdn.net/qq_32392597/article/details/103881825