Windows11二進位制方式安裝MySQL5.7.44

zwl0626881發表於2024-04-14

解壓安裝包至C:\usr\local\mysql57\3307

新建

E:\data\mysql57\3307\mysqldata

E:\data\mysql57\3307\mysqllog

E:\data\mysql57\3307\mysqltmp


## SYSTEM ENVIRONMENT PARAMETERS

MYSQL_HOME=C:\usr\local\mysql57\3307

path=......;%MYSQL_HOME%\bin


## 編輯配置檔案

將my-defaults.ini備份,修改檔名為my.ini

編輯my.ini


## 管理員身份執行cmd/終端

C:\Windows\system32> mysqld --version

mysqld Ver 5.7.44 for Win64 on x86_64 (MySQL Community Server (GPL))

#### mysqld --initialize --basedir=C:\opt\mysql --datadir=C:\opt\mysqldata --init-file=C:\opt\mysqldata\init.txt

#### 注:使用–initialize-insecure生成空密碼。使用–initialize生成隨機初始預設密碼,

C:\Windows\system32> mysqld --initialize --basedir=C:\usr\local\mysql57\3307 --datadir=E:\data\mysql57\3307\mysqldata\

C:\usr\local\mysql57\3307\mysqllog> type E:\data\mysql57\3307\mysqllog\mysql57_3307.err

2016-08-31T07:44:37.510047Z 1 [Note] A temporary password is generated for root@localhost: ggIx)PR:3Rx.

##密碼帶"." 密碼用雙引號"ggIx)PR:3Rx."


## 如果執行mysqld --initialize-secure --basedir=C:\usr\local\mysql57\3307 --datadir=E:\data\mysql57\3307\mysqldata

## 則生成密碼為空

## 執行SET PASSWORD FOR 'root'@'localhost' = PASSWORD('6');


## 安裝服務

## mysqld --install

## mysqld --install-manual

mysqld --install mysql57_3307


C:\opt\mysql\bin> mysql -u root -p"Jmcb)K.1Lv_d"

...

Server version: 5.7.44-log

...

mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('6');

Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> flush privileges;

Query OK, 0 rows affected (0.01 sec)



## 附件《Windows安裝配置檔案5.7(3307) my.ini》

[mysqld]

#### database configure

basedir= C:\usr\local\mysql57\3307

datadir= E:\data\mysql57\3307\mysqldata\

tmpdir= E:\data\mysql57\3307\mysqltmp

user=mysql

port=3307

symbolic-links=0

show_compatibility_56=1



#### memory configure

sort_buffer_size=3M

table_open_cache=4096


#### connection configuration

max_connections=2000

max_allowed_packet=1024M

connect_timeout=60

net_read_timeout=60


#### skip configuration

# skip-name-resolve


#### innodb_configuration

default_storage_engine=InnoDB

innodb_file_per_table=1

innodb_open_files=4096

innodb_buffer_pool_size=2048M

innodb_log_group_home_dir= E:\data\mysql57\3307\mysqllog

innodb_log_files_in_group=4

innodb_log_file_size=64M

innodb_log_buffer_size=32M

innodb_page_size=16384


#### sql configuration

sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'

group_concat_max_len=1024000


#### object_configuration

event_scheduler=1

log_bin_trust_function_creators=1


#### character set

character-set-server=utf8

collation-server=utf8_general_ci

lower-case-table-names=1


#### log configure

pid-file= E:\data\mysql57\3307\mysqltmp\mysqld.pid

log-error= E:\data\mysql57\3307\mysqllog\mysql57_3307.err

log-bin= E:\data\mysql57\3307\mysqllog\mysql57_3307-bin

slow-query-log=1

long-query-time=1

slow-query-log-file= E:\data\mysql57\3307\mysqllog\mysql57_3307-slow.log

socket= E:\data\mysql57\3307\mysqltmp\mysql.sock

relay-log= E:\data\mysql57\3307\mysqllog\mysql57_3307-relay-bin

max_binlog_size=800M

innodb_flush_log_at_trx_commit=1


#### replication configure

server-id = 27

replicate-wild-ignore-table = mysql.%

replicate-wild-ignore-table = information_schema.%

replicate-wild-ignore-table = performance_schema.%

replicate-wild-ignore-table = sys.%

binlog-format=ROW

binlog-row-image=full

binlog-rows-query-log-events=1

sync_binlog=1

log-slave-updates=true

gtid-mode=on

enforce-gtid-consistency=true


#### time configure

explicit_defaults_for_timestamp=true

default_time_zone='+8:00'


[client]

socket= E:\data\mysql57\3307\mysqltmp\mysql.sock


[mysql]

prompt='local_mysql57_3307> '



來自 “ ITPUB部落格 ” ,連結:https://blog.itpub.net/22581916/viewspace-3012496/,如需轉載,請註明出處,否則將追究法律責任。

相關文章