MySQL Shell 9.7  /  MySQL AdminAPI  /  Resetting Internal Replication Account Credentials

6.5 Resetting Internal Replication Account Credentials

reset_replication_accounts_password() enables you to reset, or recreate, the credentials for the internal recovery and replication accounts used in your Cluster, ClusterSet, or ReplicaSet.

This function has the following syntax:

      topology.reset_replication_accounts_password([options])

The function can be run with or without options. If run without options, it resets the passwords of all internal replication accounts. For example:

cluster.reset_replication_accounts_password()
* Verifying Cluster 'devCluster' status
* Resetting replication accounts of Cluster 'devCluster'...

The replication account passwords of all the Cluster instances were successfully reset.

The following options are available:

  • force: Boolean. Whether the operation should continue in the event of an error, such as an instance is OFFLINE and the reset cannot be performed. Default value is false.

    Note

    This option is not recommended and should only be used if instances are permanently unavailable or will not be reused in the topology.

  • recreate: Boolean. Whether to recreate the internal replication accounts. This option can migrate existing accounts using deprecated or obsolete authentication plugins, such as mysql_native_password, which was removed in MySQL 9.0.

The following example shows the recreate option:

cluster.reset_replication_accounts_password({"recreate":"true"})
* Verifying Cluster 'devCluster' status
* Recreating replication accounts of Cluster 'devCluster'...

The replication account passwords of all the Cluster instances were successfully recreated.

Topology Notes

This section describes topology-specific notes for the reset_replication_accounts_password() function:

  • Cluster

    • If cluster.reset_replication_accounts_password() is run on a Cluster which belongs to a ClusterSet, it fails and returns a message instructing you to run clusterset.reset_replication_accounts_password().

  • ClusterSet

    • Skips Clusters whose globalStatus=INVALIDATED and fails if any member Cluster has a global status which is not OK. This condition cannot be overridden by the force option.

    • Synchronizes replication on eligible Replica Clusters before applying credential changes.

    • Fails if any required Cluster or instance is unreachable, unless force:true.

  • ReplicaSet

    • Operation fails if members are not reachable, unless force:true.