Win7 x64 下 MySQL 5.7.5-m15-winx64 ZIP 免安裝版部署完整記錄:解壓、my.ini、PATH、服務註冊、初始化、密碼修改、遠程 root 授權。
官網:https://cdn.mysql.com/Downloads/MySQL-5.7/mysql-5.7.5-m15-winx64.zip
解壓至:D:\MySqlDataBase\mysql-5.7.5-m15-winx64
my.ini[client]
default-character-set=utf8
[mysqld]
port=3306
basedir="D:\MySqlDataBase\mysql-5.7.5-m15-winx64/"
datadir="D:\MySqlDataBase\mysql-5.7.5-m15-winx64/data/"
tmpdir="D:\MySqlDataBase\mysql-5.7.5-m15-winx64/data/"
socket="D:\MySqlDataBase\mysql-5.7.5-m15-winx64/data/mysql.sock"
log-error="D:\MySqlDataBase\mysql-5.7.5-m15-winx64/data/mysql_error.log"
max_connections=100
table_open_cache=256
query_cache_size=1M
tmp_table_size=32M
thread_cache_size=8
innodb_data_home_dir="D:\MySqlDataBase\mysql-5.7.5-m15-winx64/data/"
innodb_flush_log_at_trx_commit=1
innodb_log_buffer_size=128M
innodb_buffer_pool_size=128M
innodb_log_file_size=10M
innodb_thread_concurrency=16
innodb-autoextend-increment=1000
join_buffer_size=128M
sort_buffer_size=32M
read_rnd_buffer_size=32M
max_allowed_packet=32M
explicit_defaults_for_timestamp=true
sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
D:\MySqlDataBase\mysql-5.7.5-m15-winx64\bin; # 注意分號
cd D:\MySqlDataBase\mysql-5.7.5-m15-winx64\bin
mysqld install MySQL --defaults-file="D:\MySqlDataBase\mysql-5.7.5-m15-winx64\my.ini"
# 移除:mysqld remove
net start mysql # 啟動
net stop mysql # 停止
mysql -uroot
USE mysql;
UPDATE user SET password=PASSWORD('wenthink') WHERE user='root';
FLUSH PRIVILEGES;
QUIT
mysql -uroot -pwenthink
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'your_strong_password' WITH GRANT OPTION;
FLUSH PRIVILEGES;
QUIT
生產環境禁用 root 遠程登入,建立專用應用帳號、限制來源 IP、強制 SSL。
datadir 目錄必須存在,--initialize 會自動建表sql-mode 嚴格模式可能導致舊應用報錯,視業務調整免安裝版適合開發測試、多版本共存,生產環境建議 RPM/MSI/容器化標準化交付。