2.3.3.5 MySQLInstallerConsole 参考

MySQLInstallerConsole.exe提供类似于 MySQL Installer 的命令行功能。最初执行 MySQL Installer 后安装,然后在MySQL Installer目录中可用。通常,它位于C:\Program Files (x86)\MySQL\MySQL Installer\中,并且必须以 Management 特权执行控制台。

若要使用,请通过选择“开始”,“附件”来调用具有 Management 特权的命令提示符,然后右键单击“命令提示符”并选择Run as administrator。然后从命令行将目录更改为MySQLInstallerConsole.exe所在的目录:

C:\> cd Program Files (x86)\MySQL\MySQL Installer for Windows
C:\Program Files (x86)\MySQL\MySQL Installer for Windows> MySQLInstallerConsole.exe help
=================== Start Initialization ===================
MySQL Installer is running in Community mode

Attempting to update manifest.
Initializing product requirements
Loading product catalog
Checking for product catalog snippets
Checking for product packages in the bundle
Categorizing product catalog
Finding all installed packages.
Your product catalog was last updated at 11/1/2016 4:10:38 PM
=================== End Initialization ===================

The following commands are available:

Configure - Configures one or more of your installed programs.
Help      - Provides list of available commands.
Install   - Install and configure one or more available MySQL programs.
List      - Provides an interactive way to list all products available.
Modify    - Modifies the features of installed products.
Remove    - Removes one or more products from your system.
Status    - Shows the status of all installed products.
Update    - Update the current product catalog.
Upgrade   - Upgrades one or more of your installed programs.

MySQLInstallerConsole.exe支持以下命令:

Note

包含冒号(“:”)的配置块值必须用双引号引起来。例如,installdir =“ C:\ MySQL\MySQL Server 8.0”。

  • configure [product1]:[setting]=[value]; [product2]:[setting]=[value]; [...]

在系统上配置一个或多个 MySQL 产品。可以为每个产品配置多个设置值对。

Switches include:

  • -showsettings:通过在-showsettings后面 Importing 产品名称来显示所选产品的可用选项。

    • -silent:禁用确认提示。
C:\> MySQLInstallerConsole configure -showsettings server
C:\> MySQLInstallerConsole configure server:port=3307
  • help [command]

显示带有用法示例的帮助消息,然后退出。传递其他命令以获取特定于该命令的帮助。

C:\> MySQLInstallerConsole help
C:\> MySQLInstallerConsole help install
  • install [product]:[features]:[config block]:[config block]:[config block]; [...]

在系统上安装一个或多个 MySQL 产品。如果有预发布产品,则当-type开关的值为DeveloperClientFull时,将同时安装 GA 和预发布产品。仅当使用这些设置类型时,才使用-only_ga_products开关将产品集限制为 GA 产品。

开关和语法选项包括:

  • -only_ga_products:将产品集限制为仅包含 GA 产品。

    • -type=[SetupType]:安装一组 sched 义的软件。 “ SetupType”可以是以下之一:

Note

仅当未安装其他 MySQL 产品时才能选择非自定义安装类型。

  • Developer :安装完整的开发环境。

    • 服务器 :安装单个 MySQL 服务器

    • Client 端 :安装 Client 端程序和库

    • 完全 :安装所有内容

    • 自定义 :安装用户选择的产品。这是默认选项。

    • -showsettings:通过在-showsettings后面 Importing 产品名称来显示所选产品的可用选项。

    • -silent:禁用确认提示。

      • [config block] *:可以指定一个或多个配置块。每个配置块都是用分号分隔的键值对列 table。块可以包含“ config”或“ user”类型的键,如果未定义,则“ config”是默认类型。

包含冒号(:)的配置块值必须用双引号引起来。例如installdir="C:\MySQL\MySQL Server 8.0"

每个产品只能定义一个“ config”类型块。应该为在产品安装期间创建的每个用户定义一个“用户”块。

Note

重新配置产品时,不支持添加用户。

    • [feature] *:功能块是用分号分隔的功能列 table,或用于选择所有功能的星号(*)。
C:\> MySQLInstallerConsole install server;5.6.25:*:port=3307;serverid=2:type=user;username=foo;password=bar;role=DBManager
C:\> MySQLInstallerConsole install server;5.6.25;x64 -silent

传递附加配置块(以^分隔以适合)的示例:

C:\> MySQLInstallerConsole install server;5.6.25;x64:*:type=config;openfirewall=true; ^
          generallog=true;binlog=true;serverid=3306;enable_tcpip=true;port=3306;rootpasswd=pass; ^
          installdir="C:\MySQL\MySQL Server 5.6":type=user;datadir="C:\MySQL\data";username=foo;password=bar;role=DBManager
  • list

列出一个交互式控制台,可以在其中搜索所有可用的 MySQL 产品。执行MySQLInstallerConsole list以启动控制台,然后 Importing 子字符串进行搜索。

C:\> MySQLInstallerConsole list
  • modify [product1:-removelist|+addlist] [product2:-removelist|+addlist] [...]

修改或显示以前安装的 MySQL 产品的功能。

  • -silent:禁用确认提示。
C:\> MySQLInstallerConsole modify server
C:\> MySQLInstallerConsole modify server:+documentation
C:\> MySQLInstallerConsole modify server:-debug
  • remove [product1] [product2] [...]

从系统中删除一种或多种产品。

  • *:传入*以删除所有 MySQL 产品。

    • -continue:即使发生错误也要 continue 操作。

    • -silent:禁用确认提示。

C:\> MySQLInstallerConsole remove *
C:\> MySQLInstallerConsole remove server
  • status

快速概述系统上安装的 MySQL 产品。信息包括产品名称和版本,体系结构,安装日期和安装位置。

C:\> MySQLInstallerConsole status
  • update

将最新的 MySQL 产品目录下载到您的系统。成功后,将在下一次执行 MySQLInstaller 或 MySQLInstallerConsole 时应用下载目录。

C:\> MySQLInstallerConsole update

Note

“自动目录更新 GUI”选项从 Windows Task Scheduler 执行此命令。

  • upgrade [product1:version] [product2:version] [...]

在系统上升级一个或多个产品。语法选项包括:

  • *:传入*以将所有产品升级到最新版本,或传入特定的产品。

    • !:Importing!作为版本号,以将 MySQL 产品升级到最新版本。

    • -silent:禁用确认提示。

C:\> MySQLInstallerConsole upgrade *
C:\> MySQLInstallerConsole upgrade workbench:6.3.5
C:\> MySQLInstallerConsole upgrade workbench:!
C:\> MySQLInstallerConsole upgrade workbench:6.3.5 excel:1.3.2