卸载
1.卸载软件
在应用与功能中找到Mysql进行卸载
两个都需要卸载
点击OK就行
注意:
- mysql服务也会卸载
- mysql的数据文件不会被卸载
2.删除环境变量
3.删除注册表
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 (无需积分)
安装
1.双击安装包
2.选择自定义安装,然后点击next
3.选择mysql
4.点击右边的mysql,然后点击Advanced Options
![image-20220701224402555](https://asaadsasa.oss-cn-beijing.aliyuncs.com/image-20220701224402555.png
在这可以选择mysql服务端的安装位置和mysql数据的位置,选完之后点击OK
再点击OK,然后再点击Next
5.点击Next
在本界面也可以选择服务端安装位置和数据存储位置,然后点击Next
提示data位置已存在,点击yes,忽略警告
6.完成安装
点击execute
点击next
再点击next
7.配置
默认3306,不用改,直接点击next
mysql8.0才有的,直接点击next即可
默认有个账户叫root,然后输入密码,在下面也可以添加用户
点击Ok
点击next
8.完成配置
默认会勾上Start the Mysql server at System startup,然后点击next
点击execute
点击finish完成配置
9.配置环境变量
新建MYSQL_HOME,路径指向mysql服务端的bin目录
在path系统变量新建%MYSQL_HOME%
验证
C:\Users\hq>mysql --version
mysql Ver 8.0.29 for Win64 on x86_64 (MySQL Community Server - GPL)
提示这样的就成功
10.连接到Mysql
# 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>