Documentation Home
MySQL Router 8.0
Related Documentation Download this Manual
PDF (US Ltr) - 0.6Mb
PDF (A4) - 0.6Mb


MySQL Router 8.0  / ...  / Configuration  / Configuration Options  / MySQL Router Command Line Programs  /  mysqlrouter — Command Line Options

4.3.2.1 mysqlrouter — Command Line Options

MySQL Router accepts command line options that are passed intomysqlrouter to affect its behavior, or to bootstrap router based on an InnoDB Cluster.

When starting Router, you can optionally use--config to pass in the main configuration file's location (otherwise the default location is used) and--extra-config for an additional configuration file.

Bootstrapping command line options affect the generated files and directories that are used when starting MySQL Router.

mysqlrouter Option Summaries

Table 4.2 General Options

Option NameDescriptionIntroduced
--conf-set-optionSets a value for a generated configuration option during bootstrap8.0.28
--configRead configuration options from the provided file
--core-fileWrite core file on Router crashes8.0.31
--extra-configRead this file after configuration files are read from either default locations or from files specified by the --config option
--helpDisplay help text and exit
--pid-fileLocation to store the PID file8.0.20
--userRun mysqlrouter as the user having the defined user name or numeric user id
--versionDisplay version information and exit

Table 4.3 Bootstrapping Options

Option NameDescriptionIntroduced
--accountThe MySQL user account used by Router after bootstrapping8.0.19
--account-createBootstrapped account creation behavior8.0.19
--account-hostThe host pattern used for bootstrapped accounts8.0.12
--bootstrapBootstrap and configure Router for operation with a MySQL InnoDB cluster
--bootstrap-socketConnect to the MySQL metadata server through a Unix domain socket, used in conjunction with --bootstrap
--conf-base-portBase port to use for listening Router ports
--conf-bind-addressIP address of the interface to which router's listening sockets should bind
--conf-skip-tcpWhether to disable binding of a TCP port for incoming connections
--conf-target-clusterSets the target_cluster metadata option to a cluster type8.0.27
--conf-target-cluster-by-nameSets the target_cluster metadata option to a specific cluster name8.0.27
--conf-use-gr-notificationsEnables Group Replication notifications8.0.17
--conf-use-socketsWhether to use Unix domain sockets
--connect-timeoutNumber of seconds before connection attempts to a metadata server are considered timed out
--directoryCreates a self-contained directory for a new instance of the Router
--disable-restDisables generation of REST API configuration details into the generated mysqlrouter.conf file8.0.22
--forceForce reconfiguration of a possibly existing instance of the router
--force-password-validationWhen creating a user account automatically, do not skip the validate_password mechanism
--https-portMySQL Router REST API HTTP server port8.0.22
--master-key-readerScript that returns the master key to STDOUT8.0.12
--master-key-writerScript that reads the master key from STDIN8.0.12
--nameGives a symbolic name for the router instance
--password-retriesThe number of retries to use for generating the Router's user password
--read-timeoutNumber of seconds before read operations to a metadata server are considered timed out
--report-hostRouter's hostname; overrides auto-detection8.0.12
--strictEnables bootstrap strict mode8.0.19

Table 4.4 SSL Options

Option NameDescriptionIntroduced
--client-ssl-certThe path to the SSL public key certificate file, in PEM format, used to encrypt client-to-router connections8.0.23
--client-ssl-cipherWhich ciphers are allowed between client and MySQL Router, defaults to a secure list of SSL ciphers8.0.23
--client-ssl-curvesWhich curves are allowed between the client and MySQL Router, defaults to a secure list of SSL curves8.0.23
--client-ssl-dh-paramsFilename of the DH parameter file. Not set by default8.0.23
--client-ssl-keyThe path name of the SSL private key file, in PEM format, used to encrypt client-to-router connections8.0.23
--client-ssl-modeControls if connections from the client to MySQL Router must be encrypted, defaults to PREFERRED if not set8.0.23
--server-ssl-caThe path to the Certificate Authority (CA) certificate file in PEM format8.0.23
--server-ssl-capathThe path to the directory that contains the trusted SSL Certificate Authority (CA) certificate files in PEM format.8.0.23
--server-ssl-cipherSSL Cipher for Server8.0.23
--server-ssl-crlThe path to the file containing the certificate revocation lists in PEM format8.0.23
--server-ssl-crlpathThe path to the directory that contains the certificate revocation list files in PEM format8.0.23
--server-ssl-curvesSSL Curves for Server8.0.23
--server-ssl-modeControls if connections from router to server must be encrypted.8.0.23
--server-ssl-verifyVerification of the SSL certificates presented to the router by the server8.0.23
--ssl-caPath to SSL Certificate Authority file to verify server's certificate against
--ssl-capathDirectory that contains trusted SSL Certificate Authority certificate files
--ssl-certThe client-side SSL certificate to facilitate client-side authentication during bootstrap
--ssl-cipherA colon-separated list of SSL ciphers to allow, if SSL is enabled
--ssl-crlPath to SSL CRL file to use when verifying server certificate
--ssl-crlpathPath to directory containing SSL CRL files to use when verifying server certificate
--ssl-keyThe private SSL key to facilitate client-side authentication during bootstrap
--ssl-modeDesired security state when connecting to the metadata server during bootstrap and normal operation. Analogous to --ssl-mode in mysql client
--tls-versionComma-separated list of TLS versions to request, if SSL is enabled

Table 4.5 Windows Services Options

Option NameDescription
--clear-all-credentialsClear all stored credentials
--install-serviceInstall MySQL Router as service and set it to automatically start when Windows restarts; service name defaults to MySQLRouter (Windows only)
--install-service-manualInstall MySQL Router as service that can be manually started; service name defaults to MySQLRouter (Windows only)
--remove-credentials-sectionRemove a section's credentials
--remove-serviceRemove MySQL Router as a Windows service; service name defaults to MySQLRouter
--serviceStart MySQL Router as a Windows service
--update-credentials-sectionUpdate a section's credentials

mysqlrouter Option Descriptions
  • --version,-V

    Command-Line Format--version , -V

    Displays the version number and related information of the application, and exits. For example:

    $> mysqlrouter --versionMySQL Router v8.0.44 on Linux (64-bit) (GPL community edition)
  • --help,-?

    Command-Line Format--help , -?

    Display help and informative information, and exit.

    The--help option has an added benefit. Along with the explanation of each of the options, the--help option also displays the paths used to find the configuration file, and also several default paths. The following excerpt of the--help output shows an example from a Ubuntu 16.04 machine:

    $> mysqlrouter --help...Start MySQL Router.Configuration read from the following files in the given order (enclosedin parentheses means not available for reading):  (/etc/mysqlrouter/mysqlrouter.conf)  /home/philip/.mysqlrouter.confPlugin Path:  /usr/lib/x86_64-linux-gnu/mysqlrouterDefault Log Directory:  /var/log/mysqlrouterDefault Persistent Data Directory:  /var/lib/mysqlrouterDefault Runtime State Directory:  /run/mysqlrouterUsage: mysqlrouter [-V|--version] [-?|--help]...

    The configuration section shows the order for the paths that may be used for reading the configuration file. In this case, only the second file is accessible.

  • --bootstrapURI,-BURI

    Command-Line Format--bootstrap URI, -B URI
    TypeString

    The main option to perform a bootstrap of MySQL Router by connecting to the InnoDB Cluster metadata server at the URI provided. MySQL Router configures itself based on the information retrieved from the InnoDB Cluster metadata server. A password is prompted for if needed. If a username is not provided as part of the URI then the default user name "root" is used. SeeConnecting Using URI-Like Connection Strings for information on using a path to specify a server instance.

    Note

    While--bootstrap accepts a URI for TCP/IP connections, using the--bootstrap-socket option with a local Unix domain socket name replaces the "host:port" part of the URI passed to the--bootstrap option with the socket on the same machine.

    By default, the bootstrap process performs a system-wide configuration of MySQL Router. Only one instance of MySQL Router can be configured for system-wide operation. The system instance of MySQL Router has arouter_name of "system". If additional instances are desired, use the--directory option to create self-contained MySQL Router installations.

    URI: a server instance from an InnoDB Cluster to fetch metadata information from. If the providedURI is a read-only instance, MySQL Router automatically reconnects to a read-write instance in the InnoDB Cluster so it can register MySQL Router.

    If a configuration file already exists when you start MySQL Router with the--bootstrap, the existingrouter_id in that file is reused, and a reconfiguration process occurs. The configuration file is regenerated from scratch and the MySQL Router's metadata server account is recreated, although with the same name.

    During the reconfiguration process, all changes made to an existing configuration file are discarded. To customize a configuration file and still retain the ability of automatic reconfiguration (bootstrapping), you can use the--extra-config command line option to specify an additional configuration file that is read after the main configuration file. These configuration options are used because this extra configuration file is loaded after the main configuration file.

    The bootstrap process creates a new MySQL user account with a randomly generated password to use by that specific MySQL Router instance. This account is used by MySQL Router when connecting to the metadata server and InnoDB cluster to fetch information about its current state. For detailed information about this user including how its password is stored and the MySQL privilege it requires, see documentation for theMySQL user option.

    The generated configuration file is namedmysqlrouter.conf, and its location depends on the type of instance being configured, the system, and the package. For system-wide installations, the generated configuration file is added to the system's configuration directory such as/etc or%PROGRAMDATA%\MySQL\MySQL Router\. Executingmysqlrouter --help will display this location.

    The--user option is required if executing a bootstrap with a super user (uid=0). Although not recommended, forcing the super user is possible by passing its name as an argument such as--user=root.

    The minimum GRANT permissions required to execute--bootstrap are:

    GRANT CREATE USER ON *.* TO 'bootstrapuser'@'%' WITH GRANT OPTION;GRANT SELECT, INSERT, UPDATE, DELETE, EXECUTE ON mysql_innodb_cluster_metadata.* TO 'bootstrapuser'@'%';GRANT SELECT ON mysql.user TO 'bootstrapuser'@'%';GRANT SELECT ON performance_schema.replication_group_members TO 'bootstrapuser'@'%';GRANT SELECT ON performance_schema.replication_group_member_stats TO 'bootstrapuser'@'%';GRANT SELECT ON performance_schema.global_variables TO 'bootstrapuser'@'%';

    Using--bootstrap adds default values to the generated MySQL Router configuration file, and some of these default values depend on other conditions. Listed below are some of the conditions that affect the generated default values, where default is defined by passing in--bootstrap by itself.

    Table 4.6 Conditions that affect default --bootstrap values

    ConditionDescription
    --conf-base-port

    Modifies generatedbind_port values for each connection type.

    By default, generatedbind_port values are as follows: For the classic protocol, Read-Write uses 6446 and Read-Only uses 6447, and for the X protocol Read-Write uses 6448 and Read-Only uses 6449.

    As of Router 8.0.24: Setting--conf-base-port to 0 changes the defaultbind_port values to previous (before 8.0.24) defaults, which were as follows: For the classic protocol, Read-Write uses 6446 and Read-Only uses 6447, and for the X protocol Read-Write uses 64460 and Read-Only uses 64470.

    --conf-use-socketsInsertssocket definitions for each connection type.
    --conf-skip-tcpTCP/IP connection definitions are not defined.
    --directoryAffects all file paths, and also generates additional files.
    OtherThis list is not exhaustive, other options and conditions also affect the generated values.

  • --bootstrap-socketsocket_name

    Command-Line Format--bootstrap-socket socket_name
    Platform SpecificLinux

    Used in conjunction with--bootstrap to bootstrap using a local Unix domain socket instead of TCP/IP. The--bootstrap-socket value replaces the "host:port" part in the--bootstrap definition with the assigned socket name for connecting to the MySQL metadata server using Unix domain sockets. This is the MySQL instance that is being bootstrapped from, and this instance must be on the same machine if sockets are used. For additional details about how bootstrapping works, see--bootstrap.

    This option is different than the--conf-use-sockets command line option that sets thesocket configuration file option during the bootstrap process.

    This option is not available on Windows.

  • --core-file

    Command-Line Format--core-file[={0|1}]
    Introduced8.0.31
    TypeBoolean
    Default Value0

    Write a core file ifmysqlrouter dies. The name and location of the core file is system dependent. On Linux, a core file namedcore.pid is written to the current working directory of the process.pid represents the process ID of the server process. On macOS, a core file namedcore.pid is written to the/cores directory, if the process has thecom.apple.security.get-task-allow entitlement. On Solaris, use thecoreadm command to specify where to write the core file and how to name it. On Windows, a minidump file namedmysqlrouter.{pid}.dmp is written to the current working directory of the process.

  • --directorydir_path,-ddir_path

    Command-Line Format--directory dir_path, -d dir_path
    TypeString

    Specifies that a self-contained MySQL Router installation will be created at the defined directory instead of configuring the system-wide router instance. This also allows multiple router instances to be created on the same system.

    The self-contained directory structure for Router is:

    $path/start.sh$path/stop.sh$path/mysqlrouter.pid$path/mysqlrouter.conf$path/mysqlrouter.key$path/run$path/run/keyring$path/data$path/log$path/log/mysqlrouter.log

    If this option is specified, the keyring file is stored under the runtime state directory of that instance, underrun/ in the specified directory, as opposed to the system-wide runtime state directory.

    If--conf-use-sockets is also enabled then the generated socket files are also added to this directory.

  • --master-key-writer

    Command-Line Format--master-key-writer file_path
    Introduced8.0.12
    TypeString

    This optional bootstrap option accepts a script that reads the master key fromSTDIN. It also uses theROUTER_ID environment variable set by MySQL Router before themaster-key-writer script is called.

    Themaster-key-writer andmaster-key-reader options must be used together, and using them means themaster_key_file option must not be defined inmysqlrouter.conf as the master key is not written to themysqlrouter.key master key file.

    This is also written to the generated MySQL Router configuration file as themaster-key-writer [DEFAULT] option.

    Example contents of a bash script namedwriter.sh used in our example:

    #!/bin/bashKID_=$(keyctl padd user ${ROUTER_ID} @us <&0)

    Example usage:

    $> mysqlrouter --bootstrap=127.0.0.1:3310 --master-key-reader=./reader.sh   --master-key-writer=./writer.sh

    This also affects the generatedmysqlrouter.conf, for example:

    [DEFAULT]...master-key-reader=reader.shmaster-key-writer=writer.sh
  • --master-key-reader

    Command-Line Format--master-key-reader file_path
    Introduced8.0.12
    TypeString

    This optional bootstrap option accepts a script that writes the master key toSTDOUT. It also uses theROUTER_ID environment variable set by MySQL Router before themaster-key-reader script is called.

    Themaster-key-reader andmaster-key-writer options must be used together, and using them means themaster_key_file option must not be defined inmysqlrouter.conf as the master key is not written to themysqlrouter.key master key file, and instead uses the value provided by this option's script.

    This is also written to the generated MySQL Router configuration file as themaster-key-reader [DEFAULT] option.

    Example contents of a bash script namedreader.sh used in our example:

    #!/bin/bashKID_=$(keyctl search @us user ${ROUTER_ID} 2>/dev/null)if [ ! -z $KID_ ]; then  keyctl pipe $KID_fi

    Example usage:

    $> mysqlrouter --bootstrap=127.0.0.1:3310 --master-key-reader=./reader.sh   # Or, multiple hosts--master-key-writer=./writer.sh

    This also affects the generatedmysqlrouter.conf, for example:

    [DEFAULT]...master-key-reader=reader.shmaster-key-writer=writer.sh
  • --strict

    Command-Line Format--strict
    Introduced8.0.19
    TypeString

    Enables strict mode, which for example causes the bootstrap--account user verification check to stop the bootstrap process rather than only emit a warning and continue if the supplied user does not pass the check.

  • --account

    Command-Line Format--account username
    Introduced8.0.19
    TypeString

    A bootstrap option to specify the MySQL user to use, which either reuses an existing MySQL user account or creates one; behavior controlled by the related--account-create option.

    With--account, usage favors ease of management over ease of deployment as multiple routers may share the same account, and the username and password are manually defined rather than auto-generated.

    Setting this option triggers a password prompt for this account regardless of whether the password is available in the keyring.

    Bootstrapping without passing in--account does not recreate an existing MySQL server account. Prior to MySQL Router 8.0.18, bootstrapping would DROP the existing user and recreate it.

    Using this option assumes the user has sufficient access rights for Router because the bootstrap process does not attempt to add missing grants to existing accounts. The bootstrap process does verify the permissions and outputs information to the console of the failed check. The bootstrap process continues despite these failed checks unless the optional--strict option is also used. Example required permissions:

    GRANT USAGE ON *.* TO `theuser`@`%`GRANT SELECT, EXECUTE ON `mysql_innodb_cluster_metadata`.* TO `theuser`@`%`GRANT INSERT, UPDATE, DELETE ON `mysql_innodb_cluster_metadata`.`routers` TO `theuser`@`%`GRANT INSERT, UPDATE, DELETE ON `mysql_innodb_cluster_metadata`.`v2_routers` TO `theuser`@`%`GRANT SELECT ON `performance_schema`.`global_variables` TO `theuser`@`%`GRANT SELECT ON `performance_schema`.`replication_group_member_stats` TO `theuser`@`%`GRANT SELECT ON `performance_schema`.`replication_group_members` TO `theuser`@`%`

    A password is not accepted from the command-line. For example, passing in "foo:bar" assumes "foo:bar" is the desired username rather than userfoo with the passwordbar.

  • --account-create

    Command-Line Format--account-create behavior
    Introduced8.0.19
    TypeString
    Default Valueif-not-exists
    Valid Values

    if-not-exists

    always

    never

    Specify the account creation policy to help guard against accidentally bootstrapping with the wrong user account. Potential values are:

    • if-not-exists (default): Bootstrap either way; reuse the account if it exists, otherwise create it.

    • always: Only bootstrap if the account does not already exist; and create it.

    • never: Only bootstrap if the account already exists; and reuse it.

    This option requires that the--account option is also used, and that--account-host is not used.

  • --account-host

    Command-Line Format--account-host host_pattern
    Introduced8.0.12
    TypeString
    Default Value%

    The host pattern used for accounts created by MySQL Router during the bootstrap process. This is optional and defaults to '%'.

    Pass in this option multiple times to define multiple patterns, in which case the generated MySQL accounts use the same password.

    Note

    Router does not perform sanity checking and does not ensure that the pattern authorizes Router to connect.

    Note

    Bootstrapping reuses existing Router accounts by dropping and recreating the user, and this user recreation process applies to every host.

    Examples:

    # One host$> mysqlrouter --bootstrap localhost:3310 --account-host host1# Or, multiple hosts$> mysqlrouter --bootstrap localhost:3310 --account-host host1 --account-host host2   --account-host host3
  • --conf-use-sockets

    Command-Line Format--conf-use-sockets
    Platform SpecificLinux

    Enables local Unix domain sockets.

    This option is used while bootstrapping, and enabling it adds thesocket option to the generated configuration file.

    The name of the generated socket file depends on themode andprotocol options. With the classic protocol enabled, the file is namedmysql.sock in read-write mode, andmysqlro.sock in read-only mode. With the X Protocol enabled, the file is namedmysqlx.sock in read-write mode, andmysqlxro.sock in read-only mode.

    This option is not available on Windows.

  • --conf-use-gr-notifications

    Command-Line Format--conf-use-gr-notifications
    Introduced8.0.17

    Enables theuse_gr_notifications [metadata_cache] option during bootstrap. When enabled, Router is asynchronously notified about most cluster changes. Seeuse_gr_notifications for more information. In addition, using this option setsttl=60 andauth_cache_refresh_interval=60.

  • --pid-filepath

    Command-Line Format--pid-file path
    Introduced8.0.20
    TypeString

    Sets location of the PID file. This can be set in three different ways (in order of precedence): this--pid-file command-line option, settingpid_file in Router's configuration file, or defining theROUTER_PID environment variable.

    If--bootstrap is specified, then setting --pid-file causes Router to fail. This is unlike ROUTER_PID and the pid_file configuration option, which are ignored if --bootstrap is specified.

    If--bootstrap is not specified, then the following cause Router to fail: the --pid-file already exists, pid_file or ROUTER_PID are set but empty, or if Router can't write the PID file.

  • --report-host

    Command-Line Format--report-host hostname
    Introduced8.0.12
    TypeString

    Optionally define Router's hostname instead of relying on auto-detection to determine the externally visible hostname registered to metadata during the bootstrap process.

    Router does not check or confirm that the supplied hostname is reachable, but does use RFC 1123 to validate host names, and RFC 2181 to validate addresses.

    Note

    Before 8.0.23, validation checked the hostname string for illegal characters where only alphanumeric, '-', '.', and '_' characters were allowed. For example, this meant that IPv6 addresses were not allowed.

    The supplied hostname is written to the host_name field of the mysql_innodb_cluster_metadata.hosts table in the MySQL InnoDB cluster metadata store.

  • --conf-skip-tcp

    Command-Line Format--conf-skip-tcp
    Platform SpecificLinux

    Skips configuration of a TCP port for listening to incoming connections. See also--conf-use-sockets.

    This option is not available on Windows.

  • --conf-base-portport_num

    Command-Line Format--conf-base-port port_num
    TypeInteger
    Default Value0

    Base (first) value used for the listening TCP ports by settingbind_port for each bootstrapped route.

    This value is used for the classic read-write route, and each additional allocated port is incremented by a value of one. The port order set is classic read-write / read-only, and then x read-write / read-only.

    As of Router 8.0.24: Setting--conf-base-port to 0 changes the defaultbind_port values to previous (before 8.0.24) defaults, which were as follows: For the classic protocol, Read-Write uses 6446 and Read-Only uses 6447, and for the X protocol Read-Write uses 64460 and Read-Only uses 64470.

    Example usage:

    # Example without --conf-base-port$> mysqlrouter --bootstrap root@localhost:3310...Classic MySQL protocol connections to cluster 'devCluster':- Read/Write Connections: localhost:6446- Read/Only Connections: localhost:6447X protocol connections to cluster 'devCluster':- Read/Write Connections: localhost:6448- Read/Only Connections: localhost:6449# Example demonstrating --conf-base-port set to 0$> mysqlrouter --bootstrap root@localhost:3310 --conf-base-port 0...Classic MySQL protocol connections to cluster 'devCluster':- Read/Write Connections: localhost:6446- Read/Only Connections: localhost:6447X protocol connections to cluster 'devCluster':- Read/Write Connections: localhost:64460- Read/Only Connections: localhost:64470
  • --conf-bind-addressaddress

    Command-Line Format--conf-bind-address address
    TypeString
    Default Value0.0.0.0

    Modifies thebind_address value set by--bootstrap in the generated Router configuration file. By default, bootstrapping setsbind_address=0.0.0.0 for each route, and this option changes that value.

    Note

    The defaultbind_address value is127.0.0.1 ifbind_address is not defined.

  • --read-timeoutnum_seconds

    Command-Line Format--read-timeout num_seconds
    TypeInteger
    Default Value30

    Number of seconds before read operations to a metadata server are considered timed out.

    This affects read operations during both the bootstrap process, and also affects normal MySQL Router operations by setting the associatedread_timeout option in the generatedmysqlrouter.conf.

    This option is set under the[DEFAULT] namespace.

  • --connect-timeoutnum_seconds

    Command-Line Format--connect-timeout num_seconds
    TypeInteger
    Default Value30

    Number of seconds before connection attempts to a metadata server are considered timed out.

    This affects connections during both the bootstrap process, and also affects normal MySQL Router operations by setting the associatedconnect_timeout option in the generatedmysqlrouter.conf.

    There are twoconnect_timeout variants. The metadata server variant is defined under the[DEFAULT] namespace, while the MySQL server variant is defined under the[routing] namespace.

  • --user {user_name|user_id},-u {user_name|user_id}

    Command-Line Format--user {user_name|user_id}, -u {user_name|user_id}
    Platform SpecificLinux
    TypeString

    Runmysqlrouter as the user having the nameuser_name or the numeric user IDuser_id.User in this context refers to a system login account, not a MySQL user listed in the grant tables. When bootstrapping, all generated files are owned by this user, and this also sets the associateduser option.

    This systemuser is defined in the configuration file under the[DEFAULT] namespace. For additional information, see theuser option's documentation that--user configures.

    The--user option is required if executing a bootstrap as a super user (uid=0). Although not recommended, forcing the super user is possible by passing its name as an argument, such as--user=root.

    This option is not available on Windows.

  • --namerouter_name

    Command-Line Format--name router_name
    TypeString
    Default Valuesystem

    On initial bootstrap, specifies a symbolic name for a self-contained Router instance. This option is optional, and is used with--directory. When creating multiple instances, the names must be unique.

  • --force-password-validation

    Command-Line Format--force-password-validation
    Platform SpecificLinux

    By default, MySQL Router skips the MySQL Server's validate_password mechanism and instead Router generates and uses a STRONG password based on known validate_password default settings. This is because validate_password can be configured by the user and Router can not take into account unusual custom settings.

    This option ensures that password validation (validate_password) is not skipped for generated passwords, and it is disabled by default.

  • --password-retriesnum_retries

    Command-Line Format--password-retries num_retries
    TypeInteger
    Default Value20
    Minimum Value1
    Maximum Value10000

    Specifies the number of times MySQL Router should attempt to generate a password when creating user account with the password validation rules. The default value is 20. The valid range is 1 to 10000.

    The most likely reason for failure is due to custom validate_password settings with unusual requirements such as a 50 character minimum. In that fail scenario, either--force-password-validation is set to true and/or themysql_native_password MySQL Server plugin is disabled (this plugin allows bypassing validation).

  • --force

    Command-Line Format--force

    Force a reconfiguration over a previously configured router instance on the host.

  • --ssl-modemode

    Command-Line Format--ssl-mode mode
    TypeString
    Default ValuePREFERRED
    Valid Values

    PREFERRED

    DISABLED

    REQUIRED

    VERIFY_CA

    VERIFY_IDENTITY

    SSL connection mode for use during bootstrap and normal operation when connecting to the metadata server. Analogous to--ssl-mode in themysql client.

    During bootstrap, all connections to metadata servers made by the Router will use the SSL options specified. Ifssl_mode is not specified in the configuration, it will default to PREFERRED. During normal operation, after Router is launched, its Metadata Cache plugin will read and honor all configured SSL settings.

    When set to a value other than the default (PREFERRED), anssl_mode entry is inserted under the[metadata_cache] section in the generated configuration file.

    Available values are DISABLED, PREFERRED, REQUIRED, VERIFY_CA, and VERIFY_IDENTITY. PREFERRED is the default value. As with themysql client, this value is case-insensitive.

    The configuration file equivalent is documented separately atssl_mode.

  • --ssl-certfile_path

    Command-Line Format--ssl-cert file_path
    TypeString
    Default Value

    The path name of the SSL public key certificate file in PEM format. This is used to facilitate client-side authentication during the bootstrap process. This directly matches and uses functionality of the MySQL client's--ssl-cert option.

    Like--ssl-key, this option is only used during bootstrap that uses a root account. It is useful when the root account was created with REQUIRE X509, and therefore logging in as root requires the client to authenticate itself.

  • --ssl-keyfile_path

    Command-Line Format--ssl-key file_path
    TypeString

    The path name of the SSL private key file in PEM format. This is used to facilitate client-side authentication during the bootstrap process. This directly matches and uses functionality of the MySQL client's--ssl-key option.

    Like--ssl-cert, this option is only used during a bootstrap process that uses a root account. It is useful when the root account was created with REQUIRE X509, and therefore logging in as root requires the client to authenticate itself.

  • --ssl-cipherciphers

    Command-Line Format--ssl-cipher ciphers
    TypeString
    Default Value

    A colon-separated (":") list of SSL ciphers to allow, if SSL is enabled.

  • --tls-versionversions

    Command-Line Format--tls-version versions
    TypeString
    Default Value

    A comma-separated (",") list of TLS versions to request, if SSL is enabled.

  • --ssl-cafile_path

    Command-Line Format--ssl-ca file_path
    TypeString
    Default Value

    Path to the SSL CA file to verify a server's certificate against.

  • --ssl-capathdir_path

    Command-Line Format--ssl-capath dir_path
    TypeString
    Default Value

    Path to directory containing the SSL CA files to verify a server's certificate against.

  • --ssl-crlfile_path

    Command-Line Format--ssl-crl file_path
    TypeString
    Default Value

    Path to the SSL CRL file to use when verifying a server's certificate.

  • --ssl-crlpathdir_path

    Command-Line Format--ssl-crlpath dir_path
    TypeString
    Default Value

    Path to the directory containing SSL CRL files to use when verifying a server's certificate.

  • --client-ssl-modemode

    Command-Line Format--client-ssl-mode
    Introduced8.0.23
    TypeString
    Default ValuePREFERRED
    Valid Values

    PREFERRED

    DISABLED

    PASSTHROUGH

    REQUIRED

    SSL connection mode for use during bootstrap and normal operation when connecting between MySQL Router and client.

    During bootstrap, all connections to clients made by the Router will use the SSL options specified. Ifclient_ssl_mode is not specified in the configuration, it defaults toPREFERRED.

    The configuration file equivalent is documented separately atclient_ssl_mode.

  • --client-ssl-certfile_path

    Command-Line Format--client-ssl-cert file_path
    Introduced8.0.23
    TypeString
    Default Value

    The path name of the SSL public key certificate file in PEM format. This is used to facilitate client-side authentication during the bootstrap process.

    Like--client-ssl-key, this option is only used during bootstrap that uses a root account. It is useful when the root account was created with REQUIRE X509, and therefore logging in as root requires the client to authenticate itself.

  • client-ssl-curves

    Command-Line Format--client-ssl-curves
    Introduced8.0.23
    TypeString

    Defaults to a secure list of SSL curves. Format this string as a colon separated list of curve names.

  • --client-ssl-keyfile_path

    Command-Line Format--client-ssl-key file_path
    Introduced8.0.23
    TypeString

    The path name of the SSL private key file in PEM format. This is used to facilitate client-side authentication during the bootstrap process.

    Like--client-ssl-cert, this option is only used during a bootstrap process that uses a root account. It is useful when the root account was created with REQUIRE X509, and therefore logging in as root requires the client to authenticate itself.

  • --client-ssl-cipherciphers

    Command-Line Format--client-ssl-cipher
    Introduced8.0.23
    TypeString

    A colon-separated (":") list of SSL ciphers to allow, if SSL is enabled.

  • client-ssl-dh-params

    Command-Line Format--client-ssl-dh-params=filepath
    Introduced8.0.23
    TypeString

    Filename of the DH parameter file. If specified and not empty, the DH parameters from this file are used instead of internal default DH parameters. Format the DH param file in PEM format.

  • --server-ssl-modemode

    Command-Line Format--server-ssl-mode
    Introduced8.0.23
    TypeString
    Default ValueAS_CLIENT
    Valid Values

    AS_CLIENT

    DISABLED

    PREFERRED

    REQUIRED

    SSL connection mode for use during bootstrap and normal operation when connecting between MySQL Router and server.

    During bootstrap, all connections to servers made by the Router will use the SSL options specified. Ifserver_ssl_mode is not specified in the configuration, it defaults toPREFERRED.

    The configuration file equivalent is documented separately atserver_ssl_mode.

  • --server-ssl-cipherciphers

    Command-Line Format--server-ssl-cipher
    Introduced8.0.23
    TypeString

    A colon-separated (":") list of SSL ciphers to allow, if SSL is enabled.

  • --server-ssl-cafile_path

    Command-Line Format--server-ssl-ca file_path
    Introduced8.0.23
    TypeString
    Default Value

    Path to the SSL CA file to verify a server's certificate against.

  • --server-ssl-capathdir_path

    Command-Line Format--server-ssl-capath dir_path
    Introduced8.0.23
    TypeString
    Default Value

    Path to directory containing the SSL CA files to verify a server's certificate against.

  • --server-ssl-crlfile_path

    Command-Line Format--server-ssl-crl file_path
    Introduced8.0.23
    TypeString
    Default Value

    Path to the SSL CRL file to use when verifying a server's certificate.

  • --server-ssl-crlpathdir_path

    Command-Line Format--server-ssl-crlpath dir_path
    Introduced8.0.23
    TypeString
    Default Value

    Path to the directory containing SSL CRL files to use when verifying a server's certificate.

  • server-ssl-curves

    Command-Line Format--server-ssl-curves
    Introduced8.0.23
    TypeString

    Defaults to a secure list of SSL curves. Format this string as a colon separated list of curve names.

  • --server-ssl-verifydir_path

    Command-Line Format--server-ssl-verify
    Introduced8.0.23
    TypeString
    Default ValueDISABLED
    Valid Values

    DISABLED

    VERIFY_CA

    VERIFY_IDENTITY

    Verification of the SSL certificates presented to the router by the server

    • DISABLED: the connection fails if the server does not provide a certificate in the handshake.

    • VERIFY_CA: the connection fails if the server's certificate does not match a CA trusted by MySQL Router.

    • VERIFY_IDENTITY: the connection fails if the server's certificate does not match a CA trusted by MySQL Router, or the server certificate's subject does not match the hostname or IP address MySQL Router connected to.

  • --configfile_path,-cfile_path

    Command-Line Format--config file_path, -c file_path

    Used to provide a path and file name for the configuration file to use. Use this option if you want to use a configuration file located in a folder other than the default locations.

    When used with--bootstrap, and if the configuration file already exists, a copy of the current file is saved with a.bak extension if the generated configuration file contents is different than the original. Existing.bak files are overwritten.

  • --extra-configfile_path,-afile_path

    Command-Line Format--extra-config file_path, -a file_path

    Used to provide an optional, additional configuration file to use. Use this option if you want to split the configuration file into two parts for testing, multiple instances of the application running on the same machine, etc.

    This configuration file is read after the main configuration file. If there are conflicts (an option is set in multiple configuration files), values from the file that is loaded last is used.

  • --install-service

    Command-Line Format--install-service [service_name]
    Platform SpecificWindows

    Install Router as a Windows service that automatically starts when Windows starts. The service name defaults toMySQLRouter.

    This installation process does not validate configuration files passed in via--config.

    This option is only available on Windows.

  • --install-service-manual

    Command-Line Format--install-service-manual [service_name]
    Platform SpecificWindows

    Install MySQL Router as a Windows service that can be manually started. The service name defaults toMySQLRouter.

    This option is only available on Windows. Optional service name argument available as of MySQL Router 8.0.28.

  • --remove-service

    Command-Line Format--remove-service [service_name]
    Platform SpecificWindows

    Remove the Router Windows service; service name defaults to MySQLRouter.

    This option is only available on Windows. Optional service name argument available as of MySQL Router 8.0.28.

  • --service

    Command-Line Format--service
    Platform SpecificWindows

    Start Router as a Windows service. This is a private option, meaning it is only meant to be used by the Windows Service when launching Router as a service.

    This option is only available on Windows. Optional service name argument available as of MySQL Router 8.0.28.

  • --update-credentials-section

    Command-Line Format--update-credentials-section section_name
    Platform SpecificWindows

    This option is only available on Windows, and refers to its password vault.

  • --conf-target-cluster

    Command-Line Format--conf-target-cluster value
    Introduced8.0.27
    TypeString
    Valid Values

    current

    primary

    Sets thetarget_cluster metadata MySQL Router option. Accepts one of the following strings:

    • current: setstarget_cluster to the cluster containing the node being bootstrapped against. It defines it as the cluster's UUID value.

      If this is also the Primary, it does not dynamically follow role changes like theprimary does; instead it remains static.

    • primary: setstarget_cluster to the primary cluster, including when it changes at runtime.

    See also--config-target-cluster-by-name, which sets thetarget_cluster to a specific static cluster name.

    Note

    Bootstrapping against aClusterSet requires thecluster_type Router configuration option set togr.

  • --conf-set-option

    Command-Line Format--conf-set-option section_name[:optional_section_key].option=value
    Introduced8.0.28
    TypeString

    Sets a value for a generated configuration option during bootstrap; this can set a value for any bootstrapped option, for example:

    $> mysqlrouter -B 127.0.0.1:5000 \               --directory=dir1  \               --conf-set-option=logger.level=debug \               --conf-set-option=routing:test_rw.max_connect_errors=0 \               --conf-set-option=routing:test_ro.max_connect_errors=0

    Those commands alter the default values for those specific options by defining them as such:

    [logger]level=debug[routing:test_rw]...max_connect_errors=0...[routing:test_ro]...max_connect_errors=0...

    --conf-set-option definitions take precedence over option specific parameters to set specific value. For example, if both--connect-timeout=X and--conf-set-option=DEFAULT.connect_timeout=Y are specified when bootstrapping, theconnect_timeout is set toY in the generated configuration file.

  • --conf-target-cluster-by-name

    Command-Line Format--conf-target-cluster-by-name clusterName
    Introduced8.0.27
    TypeString

    Sets thetarget_cluster metadata MySQL Router option to a specific cluster name.

    Or, instead use--conf-target-cluster to assign a dynamic cluster type, such as primary.

  • --remove-credentials-sectionsection_name

    Command-Line Format--remove-credentials-section section_name
    Platform SpecificWindows

    Remove the credentials for a given section.

    This option is only available on Windows, and refers to its password vault.

  • --clear-all-credentials

    Command-Line Format--clear-all-credentials
    Platform SpecificWindows

    Clear the password vault by removing all credentials stored in it.

    This option is only available on Windows, and refers to its password vault.

  • --disable-rest

    Command-Line Format--disable-rest
    Introduced8.0.22

    By default, configuration details for theMySQL Router REST API web service functionality are added to the generatedmysqlrouter.conf file at bootstrap; and this parameter means those details are not added. This does not disable REST API functionality, as the REST API functionality can be manually configured (to enable it) later on.

  • --https-port

    Command-Line Format--https-port value
    Introduced8.0.22
    TypeInteger
    Default Value8443
    Minimum Value1
    Maximum Value65535

    Optionally define the HTTP server'sport for the MySQL Router REST API under the [http_server] section in generatedmysqlrouter.conf at bootstrap. It defaults to 8443. Availability of the port is not checked.