随笔 - 108  文章 - 0  评论 - 11  阅读 - 11万

Mysql 5.7 for windows 免安装版(解压版)安装和配置

网上写的不近详细,这里重新整理下。

准备:

1、windows操作系统

2、mysql 的解压版压缩文件

第一步:

解压mysql的压缩包到你的安装目录,因为是虚拟机,这里我就安装在C盘下:C:\mysql-5.7.18-win32

第二步:

配置环境变量

在系统变量下找到Path这个值,

点击编辑修改,

后面添加的路径是mysql的安装路径+\bin,比如我的安装路径是 C:\mysql-5.7.18-win32

则需要添加的是 C:\mysql-5.7.18-win32\bin

注意:添加之前看结尾有没有分号,没有记得加分号再添加。

第三步:

进入mysql安装目录下的bin文件夹,安装mysql

以管理员身份运行cmd,

依次运行下列命令:

1、cd C:\mysql-5.7.18-win32\bin                   //进入安装目录下的bin文件夹

2、mysqld --install                                    //安装mysqld服务

3、配置my.ini文件

1)需要你在安装目录下新建一个名为my.ini文件,.ini是后缀名。

2)然后在安装目录下新建一个名为data的文件夹。

如图:

 

把下面代码复制到my.ini文件中,保存。

注意:代码中红色字是需要改成你自己的目录。

复制代码
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.
[client]
port = 3306
default-character-set=utf8
[mysqld]

# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M

# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin

# These are commonly set, remove the # and set as required.
character_set_server=utf8
init_connect='SET NAMES utf8'
basedir = C:\mysql-5.7.18-win32       
datadir = C:\mysql-5.7.18-win32\data
port = 3306
# server_id = .....


# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M 

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 
复制代码

 注意:

basedir = C:\mysql-5.7.18-win32       //这里改成你自己的安装目录
datadir = C:\mysql-5.7.18-win32\data   //改成 安装目录\data    这个路径存放你的数据文件

 4、初始化mysql

同样是在mysql安装目录下的bin文件夹内,

执行下面命令:

mysqld --defaults-file=C:\mysql-5.7.18-win32\my.ini --initialize --console

运行结果如下:

红框内是产生的随机密码,把它记录下来。待会登录mysql要用。

5、启动并登录mysql

依次运行下面命令:

1)net start mysql

2)mysql -u root -p

要求你输入密码,把上面产生的随机密码输入,注意大小写。

出现红框里的内容表示的登录成功。

6、重设登录密码

运行下面命令

set password for root@localhost=password('123456');           //单引号里面是你自己的密码,可以改成你自己的密码

 

出现如上图界面表示成功。

 

7、用新密码重新登录(实验新密码对不对,这步也可以不用操作)

 

 

 OK,到这里已全部完事。

 

posted on   北溟有鱼。  阅读(867)  评论(0编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示