This topic describes how to change the root user password of a tenant by using obshell-sdk-go.
Note
We recommend that you first read Get started with obshell-sdk-go to learn how to use obshell-sdk-go.
Considerations
Make sure that obshell is running.
Make sure that the tenant exists and is in the NORMAL state.
The node corresponding to the client for the request must be in an initialized cluster.
You cannot change the root user password of the system tenant.
Sample code
package main
import (
"fmt"
"github.com/oceanbase/obshell-sdk-go/services"
)
func main() {
// Create a client instance. The node address is '10.10.10.1' and the port is 2886.
client, err := services.NewClientWithPassword("10.10.10.1", 2886, "****")
if err != nil {
fmt.Print(err)
return
}
if err := client.V1().SetTenantRootPassword("t1", "old", "new"); err != nil {
fmt.Print(err)
return
}
}
References
For more information about the API, see Change a tenant password.
For more information about how to call API methods by using obshell-sdk-python, see Change a tenant password.