MySQL 5.7 安装

MySQL安装

1 下载解压版文件

image-20230501100248192

2 配置环境变量

image-20230501100720832

3 新建my.ini文件

image-20230501100922264

[client]
port=3306
default-character-set=utf8
[mysqld]
# 设置为自己的mysql的安装目录
basedir=D:\Mysql\mysql-5.7.19-winx64\
#设置为mysql的数据目录
datadir=D:\Mysql\mysql-5.7.19-winx64\data\
port=3306
character_set_server=utf8
#跳过安全检查
skip-grant-tables

4 管理员打开cmd

image-20230501102309033

image-20230501102928833

5 初始化数据库

mysqld --initialize-insecure --user=mysql

image-20230501103450883

image-20230501103633839

image-20230501103815373

6 启动MySQL

net start mysql   //开启服务
net stop mysql    //停止服务

image-20230501104042294

7 进入MySQL

mysql -u root -p

image-20230501104344147

8 修改root密码

use mysql;
update user set authentication_string=password('xx') where user='root' and Host='localhost';    
注意:最后需要带分号,回车执行指令
flush privileges;//刷新权限    

image-20230501105051233

9 删除跳过安全检查

image-20230501105313532

10 重启服务

net stop mysql
net start mysql    

image-20230501105559433

安装结束

posted @ 2023-05-01 21:18  千夜ん  阅读(44)  评论(0编辑  收藏  举报
1 2 3 4