安装多个MySQL-解压版MySQL的安装

本文以解压安装的形式进行介绍,对于多个MySQL,只需要修改端口和路径即可。

下载 MySQL ZIP 包

以 V5.7.26为例

https://downloads.mysql.com/archives/community/

https://cdn.mysql.com/archives/mysql-5.7/mysql-5.7.26-winx64.zip

my.ini

解压目录下建立:
my.ini

【注意】my.ini 文件的编码格式设置为ANSI,
【注意】: 参数请不要留空格,会识别错误。比如port = 3306

参考:
https://blog.csdn.net/houtaidaima/article/details/90048583?utm_medium=distribute.pc_relevant.none-task-blog-baidujs-1


[mysql]
# 设置mysql客户端默认字符集
default-character-set=utf8
 
[mysqld]
# 设置端口
port=3307
# 设置mysql的安装目录
basedir=D:/tools/mysql-5.7.26-winx64
# 设置mysql数据库的数据的存放目录
datadir=D:/tools/mysql-5.7.26-winx64/data
# 允许最大连接数
max_connections=200
# 服务端使用的字符集默认编码为latin1字符集
character-set-server=utf8mb4
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB

安装

// 初始化数据目录
D:\tools\mysql-5.7.26-winx64\bin\mysqld --initialize-insecure
遇到找不到路径的问题
D:\Users\rjsyb>D:\tools\mysql-5.7.26-winx64\bin\mysqld --initialize-insecure
mysqld: Can't create/write to file 'D:  ools\mysql-5.7.26-winx64\data\is_writable' (Errcode: 2 - No such file or directory)
2020-06-10T02:02:01.766402Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2020-06-10T02:02:01.773049Z 0 [ERROR] Can't find error-message file 'D:\Users\rjsyb\    ools\mysql-5.7.26-winx64\share\errmsg.sys'. Check error-message file location and 'lc-messages-dir' configuration directive.
2020-06-10T02:02:01.783473Z 0 [ERROR] --initialize specified but the data directory exists and is not writable. Aborting.
2020-06-10T02:02:01.783817Z 0 [ERROR] Aborting

【解决】 将 my.ini 中 \ 替换成 /

安装成服务
D:\tools\mysql-5.7.26-winx64\bin\mysqld install mysql5.7.26

启动服务 mysql5.7.26

初始化用户
D:\tools\mysql-5.7.26-winx64\bin\mysql -P3307 -uroot -p 

update mysql.user set authentication_string=password('123456') where user='root';

// 检查 数据目录是否正确
show global variables like "%datadir%";

// 允许root账号远程连接
grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option; 

flush privileges;
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值