你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
Test-AzMySqlFlexibleServerConnect
Test out the connection to the database server
Syntax
Test-AzMySqlFlexibleServerConnect
-Name <String>
-ResourceGroupName <String>
[-DatabaseName <String>]
-AdministratorLoginPassword <SecureString>
[-AdministratorUserName <String>]
[-DefaultProfile <PSObject>]
[<CommonParameters>]
Test-AzMySqlFlexibleServerConnect
-Name <String>
-ResourceGroupName <String>
[-DatabaseName <String>]
-QueryText <String>
-AdministratorLoginPassword <SecureString>
[-AdministratorUserName <String>]
[-DefaultProfile <PSObject>]
[<CommonParameters>]
Test-AzMySqlFlexibleServerConnect
[-DatabaseName <String>]
-QueryText <String>
-AdministratorLoginPassword <SecureString>
[-AdministratorUserName <String>]
-InputObject <IMySqlIdentity>
[-DefaultProfile <PSObject>]
[<CommonParameters>]
Test-AzMySqlFlexibleServerConnect
[-DatabaseName <String>]
-AdministratorLoginPassword <SecureString>
[-AdministratorUserName <String>]
-InputObject <IMySqlIdentity>
[-DefaultProfile <PSObject>]
[<CommonParameters>]
Description
Test out the connection to the database server
Examples
Example 1: Test connection by name
$password = ConvertTo-SecureString -String "****" -AsPlainText -Force
Test-AzMySqlFlexibleServerConnect -ResourceGroupName PowershellMySqlTest -Name mysql-test -AdministratorLoginPassword $password
The connection testing to mysql-test.database.azure.com was successful!
Test connection by the resource group and the server name
Example 2: Test connection by identity
$password = ConvertTo-SecureString -String "****" -AsPlainText -Force
Get-AzMySqlFlexibleServer -ResourceGroupName PowershellMySqlTest -ServerName mysql-test | Test-AzMySqlFlexibleServerConnect -AdministratorLoginPassword $password
The connection testing to mysql-test.database.azure.com was successful!
Test connection by the identity
Example 3: Test query by name
$password = ConvertTo-SecureString -String "****" -AsPlainText -Force
Test-AzMySqlFlexibleServerConnect -ResourceGroupName PowershellMySqlTest -Name mysql-test -AdministratorLoginPassword $password -QueryText "SELECT * FROM test"
col
-----
1
2
3
Test a query by the resource group and the server name
Example 4: Test connection by identity
Get-AzMySqlFlexibleServer -ResourceGroupName PowershellMySqlTest -ServerName mysql-test | Test-AzMySqlFlexibleServerConnect -QueryText "SELECT * FROM test" -AdministratorLoginPassword $password
col
-----
1
2
3
Test a query by the identity
Parameters
-AdministratorLoginPassword
The password of the administrator. Minimum 8 characters and maximum 128 characters. Password must contain characters from three of the following categories: English uppercase letters, English lowercase letters, numbers, and non-alphanumeric characters.
Type: | SecureString |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-AdministratorUserName
Administrator username for the server. Once set, it cannot be changed.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-DatabaseName
The database name to connect.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with Azure.
Type: | PSObject |
Aliases: | AzureRMContext, AzureCredential |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-InputObject
The server to connect. To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
Type: | IMySqlIdentity |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-Name
The name of the server to connect.
Type: | String |
Aliases: | ServerName |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-QueryText
The query for the database to test
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ResourceGroupName
The name of the resource group that contains the resource, You can obtain this value from the Azure Resource Manager API or the portal.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |