一、下载
(1)点击https://dev.mysql.com/downloads/mysql/进入mysql官网下载页面
下载过程会非常慢,我们可以下载迅雷,然后复制下载链接让迅雷帮忙下载。
二、配置
解压后目录结构大概是这样
记住这个文件夹bin路径:我的是d:\mysqls\m8\bin
然后返回桌面 以管理员运行cmd,一定要是管理员形式,要不然会提示权限不足。
然后根据cmd命令行 一步一步找到刚才的bin目录。
这个是步骤,具体就是四步
第一步:初始化data目录
第二步:安装mysql8服务
第三步:开启mysql8服务
第四步:初始化登录
# 初始化数据库,建立data目录
C:\dbs\m8\bin>mysqld --initialize-insecure
# 安装服务 wm8
C:\dbs\m8\bin>mysqld --install wm8
Service successfully installed.
# 启动服务 wm8
C:\dbs\m8\bin>net start wm8
wm8 服务正在启动 .
wm8 服务已经启动成功。
# 使用mysql -uroot 登录服务
C:\dbs\m8\bin>mysql -uroot
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.1.0 MySQL Community Server - GPL
Copyright (c) 2000, 2023, Oracle and/or its affiliates.
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> select @@version();
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '()' at line 1
mysql> select @@version;
+-----------+
| @@version |
+-----------+
| 8.1.0 |
+-----------+
1 row in set (0.00 sec)
mysql> select @@version,@@port,@@basedir,@@datadir;
+-----------+--------+------------+-----------------+
| @@version | @@port | @@basedir | @@datadir |
+-----------+--------+------------+-----------------+
| 8.1.0 | 3306 | C:\dbs\m8\ | C:\dbs\m8\data\ |
+-----------+--------+------------+-----------------+
1 row in set (0.00 sec)
mysql> select now();
+---------------------+
| now() |
+---------------------+
| 2023-08-02 10:56:23 |
+---------------------+
1 row in set (0.00 sec)
三、验证是否安装成功mysql8
打开navicat 点击测试,显示连接成功就是成功安装了mysql8