1. Enabling a disabled log in
The following example enables the login for user name is TestUser5.
ALTER LOGIN TestUser5 ENABLE;
2. Changing the password of a login for User TestUser5
The following example changes the password of login TestUser5 to a strong password.
ALTER LOGIN TestUser5 WITH PASSWORD = '<enterStrongPasswordHere>';
3. Changing the name of a login for user TestUser5
The following example changes the name of login TestUser5 to Abc2.
ALTER LOGIN TestUser5 WITH NAME = Abc2;
4. Mapping a login to a credential
The following example maps the login Abc2 to the credential Custodian04.
ALTER LOGIN Abc2 WITH CREDENTIAL = abc04;
5. Mapping a login to an Extensible Key Management credential
The following example maps the login TestUser5 to the EKM credential EKMProvider1.
ALTER LOGIN TestUser5
ADD CREDENTIAL EKMProvider1;
GO
6. Unlocking a login for user TestUser5
To unlock a SQL Server login, execute the following statement, replacing **** with the desired account password.
ALTER LOGIN [TestUser5] WITH PASSWORD = '12345' UNLOCK ;
GO
7.To unlock a login for user TestUser5 without changing the password, turn the check policy off and then on again .
ALTER LOGIN [TestUser5] WITH CHECK_POLICY = OFF;
ALTER LOGIN [TestUser5] WITH CHECK_POLICY = ON;
GO
8. Changing the password of a login using HASHED
The following example changes the password of the TestUser login to an already hashed value.
ALTER LOGIN TestUser WITH
PASSWORD = 0x01000DFD334367C60DDR41ABDE4CF700A985A13D7DFD3D6B45B3430 HASHED ;
GO
The following example enables the login for user name is TestUser5.
ALTER LOGIN TestUser5 ENABLE;
2. Changing the password of a login for User TestUser5
The following example changes the password of login TestUser5 to a strong password.
ALTER LOGIN TestUser5 WITH PASSWORD = '<enterStrongPasswordHere>';
3. Changing the name of a login for user TestUser5
The following example changes the name of login TestUser5 to Abc2.
ALTER LOGIN TestUser5 WITH NAME = Abc2;
4. Mapping a login to a credential
The following example maps the login Abc2 to the credential Custodian04.
ALTER LOGIN Abc2 WITH CREDENTIAL = abc04;
5. Mapping a login to an Extensible Key Management credential
The following example maps the login TestUser5 to the EKM credential EKMProvider1.
ALTER LOGIN TestUser5
ADD CREDENTIAL EKMProvider1;
GO
6. Unlocking a login for user TestUser5
To unlock a SQL Server login, execute the following statement, replacing **** with the desired account password.
ALTER LOGIN [TestUser5] WITH PASSWORD = '12345' UNLOCK ;
GO
7.To unlock a login for user TestUser5 without changing the password, turn the check policy off and then on again .
ALTER LOGIN [TestUser5] WITH CHECK_POLICY = OFF;
ALTER LOGIN [TestUser5] WITH CHECK_POLICY = ON;
GO
8. Changing the password of a login using HASHED
The following example changes the password of the TestUser login to an already hashed value.
ALTER LOGIN TestUser WITH
PASSWORD = 0x01000DFD334367C60DDR41ABDE4CF700A985A13D7DFD3D6B45B3430 HASHED ;
GO
Comments
Post a Comment
Please avoid link comments