Export (0) Print
Expand All

How to: Create a Database Master Key

The database-level cryptographic features in SQL Server rely on a database master key. This key is not generated automatically when the database is created; it must be created by the system administrator. It is only necessary to create the master key once per database.

To create a database master key

  1. In Query Editor, connect to the database by executing the following Transact-SQL command: USE <database name> ; GO.

  2. Choose a password for encrypting the copy of the master key that will be stored in the database.

  3. Execute the following Transact-SQL command: CREATE MASTER KEY ENCRYPTION BY PASSWORD = '<password>' ; GO 

Important noteImportant

You should immediately back up the new master key. For more information, see How to: Back Up a Database Master Key.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft