SQL Master Key Password FAQs

SQL Master Key Password FAQs

  • How to create the master key password.

The user with dbcreator permissions can follow these steps to create the master key password:

Open MSSQL Server Management Studio, right-click the database and choose New Query

In the workspace, run the following query:

CREATE MASTER KEY ENCRYPTION BY PASSWORD='<new_Masterkey_password>';
The master key password must comply with the password policy of the MSSQL-installed machine. 

Top

  • How to change the master key password. 

The user with dbcreator permissions can follow these steps to change the master password:

Open MSSQL Server Management Studio, right-click the database and choose New Query

For regenerating the database master key and all other keys, run the following query:

ALTER MASTER KEY REGENERATE WITH ENCRYPTION BY PASSWORD='<new_Masterkey_password>';

To create an additional master key password, run the following query:

ALTER MASTER KEY ADD ENCRYPTION BY PASSWORD='<new-master_key>';

Note that after you create an alternative master key password, the old master key password will still be functional. 

Top

  • How to take backup of the master key password.

Open MSSQL Server Management Studio, right-click the database and choose New Query

 In the workspace, run the following query:

BACKUP MASTER KEY TO FILE = 'path_to_file' ENCRYPTION BY PASSWORD = '<Masterkey_password>';

Top

  • How to restore the master key password?

Open MSSQL Server Management Studio, right-click the database and choose New Query

In the workspace, run the following query:

RESTORE MASTER KEY FROM FILE = 'path_to_file' DECRYPTION BY PASSWORD = '<masterkey_password_of_backup_database>' ENCRYPTION BY PASSWORD = '<masterkey_password_of_restoring_database>';

The master key password will be restored to the database.

Top

  • Why does the master key password fail during upgrade? 

This can happen of the password doesn't comply with the password policy of the MSSQL-installed machine. 

                  New to ADSelfService Plus?