SHO酱的Blog

SHO酱的Blog

Windows中升级MySQL服务

2024-11-11
Windows中升级MySQL服务

下载社区版MySQL压缩包

截止到发文之日MySQL社区版的最新版本为8.0.40,下载地址可以在这里下载

文件处理

下载mysql-8.0.40-winx64.zip文件后,直接解压,并把原来在用的MySQL版本中的data文件夹my.ini文件复制到解压后的目录中。

版本替换过程

注意:终端需要使用管理员身份运行。

  1. 通过命令行进入到mysql文件夹bin目录下面执行

    ./mysqld --remove mysql
    
  2. 进入到新版mysql的bin文件里面执行mysql安装

    ./mysqld --install mysql
    
  3. 启动Mysql服务

    ./net start mysql
    
  4. 验证Mysql版本

    select version();
    

参考

Windows系统下的mysql版本升级_windows mysql升级版本方法-CSDN博客
在Windows上升级MySQL - 安装MySQL 8
MySQL :: Download MySQL Community Server

参考中的几点说明

  1. mysql_upgrade -uroot -p
    参考原文中有一步是升级版本,在MySQL 8.0.16之后就不需要执行了,如果执行该命令会提示如下信息:

    The mysql_upgrade client is now deprecated. The actions executed by the upgrade client 
    are now done by the server.To upgrade, please start the new MySQL binary with the older 
    data directory. Repairing user tables is done automatically. Restart is not required after 
    upgrade.The upgrade process automatically starts on running a new MySQL binary with 
    an older data directory. To avoid accidental upgrades, please use the --upgrade=NONE 
    option with the MySQL binary. The option --upgrade=FORCE is also provided to run 
    the server upgrade sequence on demand.It may be possible that the server upgrade 
    fails due to a number of reasons. In that case, the upgrade sequence will run again during 
    the next MySQL server start. If the server upgrade fails repeatedly, the server can be started 
    with the --upgrade=MINIMAL option to start the server without executing the upgrade 
    sequence, thus allowing users to manually rectify the problem.
    
  2. 在复制my.ini文件后,不要忘记修改其中的文件路径等信息。

  3. 再次强调,终端需要使用管理员身份运行,否则会提示如下信息:

    Install/Remove of the Service Denied!