windows mysql 免安装_windows 免安装mysql

这篇博客详细介绍了如何在Windows上配置免安装版的MySQL。从下载MySQL压缩包开始,接着创建data文件夹和my.ini配置文件,然后设置basedir和datadir,初始化数据库,将MySQL注册为Windows服务,最后启动服务并修改root用户的密码。
摘要由CSDN通过智能技术生成

一、下载免安装压缩包

二、本地环境配置

把zip包解压到需要安装的目录 ,会发现缺少data文件夹以及my.ini的配置文件

8d4b9fc327bbd2cf518cbbc177fa7a8a.png

2.添加data文件夹以及my.ini环境配置

62e22f7aeb5db9c2965f27e071908f67.png

3. my.ini文件中添入一下内容并修改下面两项

basedir = F:/soft/mysql-5.7.25                        是你解压之后的根目录

datadir = F:/soft/mysql-5.7.25/data                是你解压之后的根目录下的data

注意:要是 / 而不是 \

# For advice on how to change settings please see

# http://dev.mysql.com/doc/refman/5.6/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 ifyou

#***upgrade to a newer version of MySQL.

[mysqld]

# Remove leading # and set to the amount of RAMforthe most important data

# cache in MySQL. Start at70% of total RAM for dedicated server, else 10%.

#innodb的缓存,可以根据实际情况调整大小,我这里采取默认值

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.

#mysql根目录

basedir= F:/soft/mysql-5.7.25#数据存储目录

datadir= F:/soft/mysql-5.7.25/data

#端口号,默认为3306

port= 3306#服务实例的唯一标识,这个是做集群的时候使用,单例可以不配置

# server_id=.....

# Remove leading # to set options mainly usefulforreporting servers.

# The server defaults are fasterfortransactions 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

#配置一下服务端的字符集

character_set_server=utf8mb4

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

#配置一下客户端的字符集

[client]default-character-set=utf8mb4

4.初始化数据库 以管理员身份运行cmd  进入到bin目录下

mysqld --initialize  执行完成之后会在data下生成一些文件

5.注册为windows服务

mysqld --install MySQL57        #install后面是服务的名字,我们这里以MySQL57作为mysql5.7的服务名

6.启动mysql 登录并修改密码

mysql -u root -p

这次的登录密码并不是空,而是在data文件夹下有一个.err结尾的文件,如下图所示

4aead27be768ca1ecd5df83089f9d707.png

找到之后可以正常登录。

7.修改密码并刷新  分号保留  修改成功之后可以正常登录

ALTER USER ‘root’@‘localhost’ IDENTIFIED BY ‘123456’;

FLUSH PRIVILEGES;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值