MySQL:zip包安装方式

Dockerfile最佳实践:优化Docker镜像构建

一、下载zip安装包

下载zip安装包:https://downloads.mysql.com/archives/community/
在这里插入图片描述

二、编写my.ini文件

MySQL5的my.ini

[client]
port=3306
default-character-set=utf8
[mysql]
# 设置mysql客户端默认字符集
default-character-set=utf8
[mysqld]
#log
general-log=0
log-output=FILE
slow-query-log=1
long_query_time=1
slow_query_log_file="D:\MySQL\mysql-5.7.28-winx64\log\log_slow.log"
log_error="D:\MySQL\mysql-5.7.28-winx64\log\log_err.log"
#log="D:\install\mysql\log\logDora.log"
#开启查询缓存
explicit_defaults_for_timestamp=true
# 设置3306端口
port = 3306
# 设置mysql的安装目录
basedir=D:\MySQL\mysql-5.7.28-winx64
# 设置 mysql数据库的数据的存放目录,MySQL 8+ 不需要以下配置,系统自己生成即可,否则有可能报错
datadir=D:\MySQL\mysql-5.7.28-winx64\data
# 允许最大连接数
max_connections=1000
max_user_connections=500
# Set the SQL mode to strict
sql_mode=NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
# 服务端使用的字符集默认为utf8字符集
character-set-server=utf8
# 创建新表时将使用的默认存储引擎
default-storage-engine=InnoDB
collation-server=utf8_general_ci
max_allowed_packet=1024MB
key_buffer_size =128M
sort_buffer_size =2M
read_buffer_size =2M
read_rnd_buffer_size =2M
tmp_table_size=16M
innodb_buffer_pool_size = 128M
innodb_log_buffer_size = 1M
group_concat_max_len = 102400

MySQL8的my.ini

[mysql]
default-character-set=utf8

[mysqld]
port=3307
default_authentication_plugin=mysql_native_password
basedir=D:\MySQL\mysql-8.0.12-winx64\
datadir=D:\MySQL\mysql-8.0.12-winx64\data\
character-set-server=utf8
default-storage-engine=MyIsam
max_connections=1000
collation-server=utf8_unicode_ci
init_connect='SET NAMES utf8'
innodb_buffer_pool_size=64M
innodb_flush_log_at_trx_commit=1
innodb_lock_wait_timeout=120
innodb_log_buffer_size=4M
innodb_log_file_size=256M
interactive_timeout=120
join_buffer_size=2M
key_buffer_size=32M
log-error="D:\MySQL\mysql-8.0.12-winx64\log"
log_error_verbosity=1
max_allowed_packet=16M
max_heap_table_size=64M
myisam_max_sort_file_size=64G
myisam_sort_buffer_size=32M
read_buffer_size=512kb
read_rnd_buffer_size=4M
server_id=1
skip-external-locking=on
sort_buffer_size=256kb
table_open_cache=256
thread_cache_size=16
tmp_table_size=64M
wait_timeout=120
[client]
port=3307
default-character-set=utf8

三、安装命令

mysqld --initialize --console		初始化MySQL,这里会给一个MySQL密码,需要保存下来
mysqld --install MySQL8 --defaults-file="D:\MySQL\mysql-8.0.12-winx64\my.ini"	安装MySQL8服务
net start MySQL8 	启动MySQL8服务
mysql -u root -p	登陆MySQL
ALTER USER root@localhost IDENTIFIED BY '123456';		修改root账号密码

如果你想同时安装多个不同版本的MySQL服务
那么,只要注意修改my.ini文件中的端口号,以及安装服务的时候,服务名不同即可。

参考:https://blog.youkuaiyun.com/qq_37738899/article/details/125608627

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值