最新版(8.0.15)MySQL免安裝版配置

以前記得配置mysql是最簡單輕鬆的東西,時隔兩年再配感覺把自己配成了傻逼,特此來記錄一下… 媽咪媽咪哄…

官網下載免安裝版的,然後解壓到指定文件夾.
首先配置環境變量: 將 mysql 文件夾下的 bin 文件夾路徑添加到系統環境變量即可(添加到 path 裏)

然後, 在mysql文件夾下新建 my.ini 文件,文件內容爲:

[client]
port=3306
 
[mysql]
 
 
[mysqld]
port=3306
#此處改爲你自己的安裝路徑
basedir="C:\mysql\mysql-8.0.15-winx64"
character-set-client-handshake=FALSE
character-set-server=utf8mb4
collation-server=utf8mb4_general_ci
default-storage-engine=InnoDB
init_connect='set names utf8mb4'
#sql-mode="NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
max_connections=512
 
tmp_table_size=18M
 
thread_cache_size=8
myisam_max_sort_file_size=64G
myisam_sort_buffer_size=35M
key_buffer_size=25M
read_buffer_size=64K
read_rnd_buffer_size=256K
sort_buffer_size=256K
#innodb_additional_mem_pool_size=2M
 
innodb_flush_log_at_trx_commit=1
innodb_log_buffer_size=1M
 
innodb_buffer_pool_size=47M
innodb_log_file_size=24M
innodb_thread_concurrency=8

由於8.0+ 都是自動創建 data 文件, 所以在配置文件裏不再需要設置 data 文件夾路徑。
另外的注意點參考博文: https://www.51-n.com/t-4580-1-1.html 。內容如下(如有侵權,請聯繫筆者刪除):

MySQL 8+ unknown variable query_cache_limit query_cache_size query_cache_type

MySQL system variables query_cache_limit, query_cache_size, query_cache_type were removed in MySQL 8.0.3, remove them from your MySQL configuration file, otherwise MySQL won’t get successfully started.

Another change is that in MySQL 8+ it is prohibited to start the server with a lower_case_table_names setting that is different from the setting used when the server was initialized. The restriction is necessary because collations used by various data dictionary table fields are based on the setting defined when the server is initialized, and restarting the server with a different setting would introduce inconsistencies with respect to how identifiers are ordered and compared.

配置好 my.ini 文件後,在管理員模式下的命令行裏 cd 到 mysql 安裝路徑的 bin 目錄下,依次執行如下命令:

mysqld --initialize --console
mysqld install
net start mysql

其中在執行完第一條命令後,如果有錯誤,在命令行窗口會顯示錯誤的詳細信息,根據錯誤信息再去找相應的解決方法;如果沒有錯誤的話,顯示如下:
在這裏插入圖片描述
其中紅色標記爲默認分配的登錄密碼,可以自己修改。
然後執行第二條進行安裝,
第三條進行啓動服務。
然後就成功啓動嘍。。。。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章