win10 MySQL 创建两个数据5.5和 5.7

转载:https://blog.csdn.net/mint6/article/details/81038536
测试环境:window10,已经安装了mysql5.5,继续安装mysql8.0

两个mysql的安装都是自定义目录,我目录是D:\mysql5.5和D:\mysql8.0

5.5已经安装好了,默认端口是3306,所以第二个需要改一下端口,这里改为3307

先修改mysql8.0目录下的配置文件,建立文件,my.ini,在里面配置

For advice on how to change settings please see

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

[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.

basedir = D:\mysql8.0
datadir = D:\mysql8.0\data
port = 3307
server_id = 1

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
然后用管理员方式打开cmd,找到mysql8.0的bin目录下

输入mysqld –defaults-file=D:\mysql8.0\my.ini –initialize –console初始化一下,执行完这个命令会发现多了一个data文件夹

注意别忘记这个密码了,先复制下来。

然后执行mysqld install MySQL3 –defaults-file=”D:\mysql8.0\my.ini” 然后返回成功。

接着win+r打开compmgmt.msc管理,找到MySQL3(自己定义的名字)启动就行了。

启动后使用navicat连接

your password has expired 密码过期了

打开管理员cmd,进入安装mysql的目录下边,bin目录,输入

mysql -uroot -p -P3307 (自己设置的端口)

然后设置密码 set password = password(‘root’);然后发现可以成功连接

假如你还是忘记了这个密码,看这里 mysql8忘记密码怎么办?

没有my.ini 文件基本格式

[client]
port=3306
default-character-set=utf8
[mysqld]

设置为自己MYSQL的安装目录

basedir=D:\mysql-5.7.20-winx64

设置为MYSQL的数据目录

datadir=D:\mysql-5.7.20-winx64\data
port=3306
character_set_server=utf8
sql_mode=NO_ENGINE_SUBSTITUTION,NO_AUTO_CREATE_USER

开启查询缓存

explicit_defaults_for_timestamp=true
skip-grant-tables

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值