在应用与功能中找到Mysql进行卸载

两个都需要卸载

点击OK就行
注意:


HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Eventlog\Application\MySQL服务 目录删除
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\MySQL服务 目录删除
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\Services\Eventlog\Application\MySQL服务 目录删除
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\Services\MySQL服务 目录删除
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application\MySQL服务目录删除
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MySQL服务删除
注:上面的有些可能没有
官网地址:https://dev.mysql.com/downloads/windows/installer/8.0.html

选择第二个

官网下载会很慢,如果不开vpn的话
这里可以直接在我的csdn下载进行下载https://download.csdn.net/download/ppjsyw/85853930 (无需积分)





再点击OK,然后再点击Next

在本界面也可以选择服务端安装位置和数据存储位置,然后点击Next

提示data位置已存在,点击yes,忽略警告

点击execute

点击next

再点击next

默认3306,不用改,直接点击next

mysql8.0才有的,直接点击next即可

默认有个账户叫root,然后输入密码,在下面也可以添加用户

点击Ok

点击next

默认会勾上Start the Mysql server at System startup,然后点击next

点击execute

点击finish完成配置
新建mysql_home,路径指向mysql服务端的bin目录

在path系统变量新建%mysqlhome%

验证
C:\Users\hq>mysql --version
mysql Ver 8.0.29 for Win64 on x86_64 (MySQL Community Server - GPL)
提示这样的就成功
# u后面是用户名,p后面是密码,u和p后面都可以带空格
C:\Users\hq>mysql -uroot -proot
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 15
Server version: 8.0.29 MySQL Community Server - GPL
Copyright (c) 2000, 2022, 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>