当前位置:网站首页>开发者,MySQL专栏完更,助你轻松从安装到入门进阶
开发者,MySQL专栏完更,助你轻松从安装到入门进阶
2022-07-04 15:35:00 【王 子】
作者:大二计算机学生小周
*主页:悄悄关注小周
关键:MySQL安装5.7
*️学习:订阅数据库专栏
深入学习MySQL
三篇学会MySQL数据库【基础知识】
三篇学会MySQL数据库【查询详解】
三篇学会MySQL数据库【高级部分】
大家好,我是小周,周棋洛的周,放假前写了三篇学习MySQL系列文章,但没讲安装配置,今天补上,配合组成一个入门系列,文章会不断修补完善,有喜欢的小伙伴可以订阅学习呀,如果觉得文章写的不错,记得三联支持可怜的博主呀

文章目录
1.下载MySQL5.7压缩包


下载完成后,解压提取
注意:解压路径中最好没有中文和空格

2.卸载MySQL服务
如果在安装过程中出错了,卸载MySQL服务可以使用以下命令
sc delete mysql
3.配置环境变量
搜索环境变量并打开

选择环境变量

选择系统变量,新建一个

变量名是MYSQL_HOME ,变量值是安装MYSQL目录中bin目录的外一层目录

找到Path变量,双击编辑

点击新建

值是%MYSQL_HOME%\bin,之后一直点击确定就OK了

4.为什么配置环境变量?
使用mysql,实际就是使用bin目录下的可执行文件,如果我们没有在MySQL的bin目录下,就无法使用这些可执行文件,但是windows如果在当前目录下没有找到,还会到path变量下查找,找到了就使用,找不到才报错,所以,配置环境变量的目的就是让我们在任意目录下都可以使用MySQL的可执行文件
5.创建my.ini文件

编辑my.ini文件,将安装目录修改为自己的安装目录,数据目录就是在安装目录后加上data目录。
[client]
port=3306
default-character-set=utf8
[mysqld]
# 设置为自己MYSQL的安装目录
basedir=D:\\mysql5.7\
# 设置为MYSQL的数据目录
datadir=D:\\mysql5.7\data\
port=3306
character_set_server=utf8
# 跳过安全检查
skip-grant-tables
6.安装数据库
搜索cmd,并使用管理员身份运行

切换至MySQL的bin目录下,执行安装命令
mysqld -install

7.初始化数据
完了,继续初始化数据库,执行下面命令:
mysqld --initialize-insecure --user=mysql
如果这里报错了,报错信息如下,就是my.ini文件的路径注意开始是双反斜杠哦,改过来再次执行就可以了
mysqld: Can't create directory 'D: oftware\environment\mysql5.7.38\mysql-5.7.38-winx64\data\' (Errcode: 2 - No such file or directory)
如果执行成功,控制台是没有提示的,但是再回到安装目录下,你会发现多出了data文件夹,而且这个文件夹是有数据的,大约在120mb左右

8.启动MySQL
net start mysql


所以说MYSQL是一个服务是没有问题的
9.进入MySQL终端
mysql -u root -p
当前root 用户密码为 空,直接回车不要输入密码

10.修改密码
use mysql;
update user set authentication_string=password('你的密码') where user='root' and Host='localhost';

11.刷新权限并退出
刷新权限
flush privileges;
退出登录
quit

12.开启权限验证
把my.ini配置文件中的跳过安全检查注释掉,下次登陆就需要输入密码了
# 跳过安全检查
#skip-grant-tables
13.重启MySQL
net stop mysql
net start mysql
14.登录MySQL

15.完美撒花
完美,数据库的安装配置,配合专栏的基础知识,查询详解,高级学习,相信你一定可以轻松入门MySQL,并随着手熟,理解一些底层并向数据库底层以及调优进军,加油吧,少年,我是小周,周棋洛的周,如果觉得文章写的不错,记得三联支持可怜的博主呀️
边栏推荐
- Median and order statistics
- Why do you say that the maximum single table of MySQL database is 20million? Based on what?
- Blood spitting finishing nanny level series tutorial - play Fiddler bag grabbing tutorial (2) - first meet fiddler, let you have a rational understanding
- 利用win10计划任务程序定时自动运行jar包
- 线性时间排序
- TP configuring multiple databases
- 智慧物流園區供應鏈管理系統解决方案:數智化供應鏈賦能物流運輸行業供應鏈新模式
- Maximum subarray and matrix multiplication
- 程序员怎么才能提高代码编写速度?
- Is it safe for Bank of China Securities to open an account online?
猜你喜欢

周大福践行「百周年承诺」,真诚服务推动绿色环保

程序员怎么才能提高代码编写速度?

祝贺Artefact首席数据科学家张鹏飞先生荣获 Campaign Asia Tech MVP 2022

Detailed process of DC-2 range construction and penetration practice (DC range Series)

Solution of commercial supply chain coordination system in the mineral industry: build a digital intelligent supply chain platform to ensure the safe supply of mineral resources

C# 更加优质的操作MongoDB数据库

Kunming Third Ring Road Closure project will pass through these places. Is there one near your home?

NoSQL之readis配置与优化(终章)
Why do you say that the maximum single table of MySQL database is 20million? Based on what?

Understand ThreadLocal in one picture
随机推荐
How can programmers improve the speed of code writing?
2022PMP考试基本情况详情了解
SQL implements split
Smart Logistics Park supply chain management system solution: digital intelligent supply chain enables a new supply chain model for the logistics transportation industry
Blood spitting finishing nanny level series tutorial - play Fiddler bag grabbing tutorial (2) - first meet fiddler, let you have a rational understanding
Height residual method
最大子数组与矩阵乘法
Is it safe for Bank of China Securities to open an account online?
The Ministry of human resources and Social Security announced the new construction occupation
Array filter fliter in JS
Can you really use MySQL explain?
第十八届IET交直流输电国际会议(ACDC2022)于线上成功举办
go-micro教程 — 第二章 go-micro v3 使用Gin、Etcd
长城证券开户安全吗 证券账户怎么开通
PyTorch深度学习快速入门教程
Rebalance operation in spark and its difference from repartition operation
Li Kou today's question -1200 Minimum absolute difference
ble HCI 流控机制
第十八届IET交直流輸電國際會議(ACDC2022)於線上成功舉辦
2022年国内云管平台厂商哪家好?为什么?