1. 程式人生 > >Windows 下Mysql 手動升級到 8.0.13

Windows 下Mysql 手動升級到 8.0.13

下載Mysql安裝包

在mysql的官網1下載mysql8.0.13版本壓縮包
Mysql下載地址

解除安裝Mysql服務

sc delete 需要管理員許可權

C:\WINDOWS\system32>sc delete
描述:
        從登錄檔刪除服務項。
        如果服務正在執行,或另一程序已經開啟
        到此服務的控制代碼,服務將簡單地標記為
        刪除。
用法:
        sc <server> delete [service name]

C:\WINDOWS\system32>sc query mysql

SERVICE_NAME: mysql
        TYPE               : 10  WIN32_OWN_PROCESS
        STATE              : 1  STOPPED
        WIN32_EXIT_CODE    : 1077  (0x435)
        SERVICE_EXIT_CODE  : 0  (0x0)
        CHECKPOINT         : 0x0
        WAIT_HINT          : 0x0

C:\WINDOWS\system32>sc delete mysql
[SC] DeleteService 成功

C:\WINDOWS\system32>

安裝Mysql8.0.13

配置檔案

找到原來安裝目錄的 .ini檔案, Mysql服務啟動時候會讀取 .ini配置檔案
在這裡插入圖片描述

將my-default.ini檔案複製到新下載的壓縮包中,為了沿用原來資料庫的資料,在這裡只修改 basedir, 其它的保持不變

在這裡插入圖片描述

.ini檔案如下

# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.

[mysqld]
explicit_defaults_for_timestamp=true
log_timestamps=SYSTEM
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M

# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin

# These are commonly set, remove the # and set as required.
[client]
port=3306
default-character-set=utf8
[mysqld]
#basedir = D:\DataBase\MySQL\mysql-5.7.19-winx64
basedir = D:\DataBase\MySQL\mysql-8.0.13-winx64
datadir = D:\DataBase\MySQL\mysql-5.7.19-winx64\data
port = 3306
character_set_server=utf8
# server_id = 


# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M 

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 

配置環境變數

在這裡插入圖片描述

使用管理員許可權安裝

D:\DataBase\MySQL\mysql-8.0.13-winx64\bin>mysqld install
Service successfully installed.

啟動服務
在這裡插入圖片描述

登入Mysql檢視資料

在這裡插入圖片描述

資料也過來了,注意,原來的data目錄不能刪除。如果想刪除,可以把data資料夾複製到mysql8.0.13
目錄下,修改.ini檔案的datadir路徑