Installing Umbraco 7 (Part 2) - Setting up a Database

For the first part in this series of blog posts which details the process that I followed to manually install Umbraco CMS version 7.3.0, I documented the steps to successfully set up a new empty project in Visual Studio 2013 and how to download and install the Umbraco CMS package to your solution using NuGet package manager.

For this second part I am going to outline the process to show how I

  • Created a new database using Microsoft SQL Server 2008R2 (that's the version i currently have installed),
  • Set up a new user and configure the permissions to be able to access the database
  • Configured the connection string in the applications web.config file to communicate with our new database.

Polite Notice: With regards to working with Umbraco, I am still very much learning the ropes myself, but I continue to research and ask questions to help enhance my existing knowledge so that I can keep applying what I believe are the best practices.

With this in mind, the information that I have made available is purely based on my experiences. Therefore, if you are reading my posts and there happens to be a better way to complete a certain process, or you feel that I have explained something wrong, please get in touch with me so that I can make the necessary updates to provide more accurate information to help others.

The primary aim of producing this series of blog posts and making them available online is to hopefully provide a helping hand to anyone who is just starting out with Umbraco and trying to get up and running quickly. Using my experiences, I know that I would have benefited from something similar when I first started out, so hopefully my posts will help someone.

Let’s Get Started!

Creating a new database with Microsoft SQL Server for your Umbraco project

Step 15 - When you have completed installing Microsoft SQL Server (and the necessary tools to manage your SQL Server Instances) launch SQL SERVER MANAGEMENT STUDIO. Select your SERVER INSTANCE as the server name and select WINDOWS AUTHENTICATION to connect to your instance. Select CONNECT.

Login in to SQL Server

Step 16 - Once you have established a connection to your local server instance, in the OBJECT EXPLORER panel, right click on the DATABASES folder and select NEW DATABASE… from the context menu.

Creating a new databse
Step 17 – In the NEW DATABASE dialog, select the GENERAL PAGE view and choose a meaningful name for your new database. I tend to use a consistent naming convention where I call my databases the same name as my visual studio project but suffixed with a _db. So in my example my database name would be INSTALLINGUMBRACODEMO_DB. Once you have named your new database, select the 'OK' button.

Naming the database

Step 18 – After selecting 'OK' to create your new database, you should notice that it now appears in the OBJECT EXPLORER as a child node of the DATABASES folder node.

Database created

Step 19 – With a new database created, the next task is to create a new user login and grant the necessary permissions to be able to access it. In the OBJECT EXPLORER expand the SECURITY FOLDER node, right click LOGINS and select NEW LOGIN from the context menu.
 Creating a new user login

Step 20 – In the NEW LOGIN dialog, switch to the GENERAL PAGE view and complete the following tasks

  1. Create a LOGIN NAME for the new user. Again to remain consistent I tend to use a convention where I call my new user the same name as my visual studio project but suffixed with a So in my example my database name would be INSTALLINGUMBRACODEMO_USER.
  2. Place a check in the SQL SERVER AUTHENTICATION option and then create a strong PASSWORD for the new user. For tutorial purposes I will set my password as For more information about connecting using SQL Server Authentication, please visit Microsoft.
  3. REMOVE the check from the ENFORCE PASSWORD POLICY This will ensure that you don’t have to update or change the password on the next logins or when it expires.
  4. Set the DEFAULT DATABASE for the new user to be the new database that was created in step 16. In my case this value will be INSTALLINGUMBRACODEMO_DB.

User Configuration

Step 21 – Switch to the USER MAPPING page view and place a check in the checkbox next to the new database. Place a check in the checkbox next to DB_OWNER so that the new user has OWNER membership for the new database. This will ensure that there are sufficient permissions assigned to work with the database. Select 'OK'.

User Mapping

Step 22 – Before moving to the next step, navigate to the newly created database and verify that a new login has been added for the newly created user e.g. In the OBJECT EXPLORER navigate to INSTALLINGUMBRACODEMO_DB > SECURITY> USERS and verify that the new user exists in the list below the security folder node.

 User mapping to the database
Step 23 – To test that the new user has sufficient access to login to the new database, create a new connection to your SQL SERVER INSTANCE, switch the mode to SQL SERVER AUTHENTICATION and enter the new user’s LOGIN NAME and PASSWORD that you created in step 20. In my case this would be

Login - INSTALLINGUMBRACODEMO_USER
Password - mySecurePassword1234

If you can successfully login, it verifies that the application will be able to successfully connect to the database using these credentials. Note: The only database tables that should be accessible to the user logged in are the ones available in the new database that was created.

testing user credentials

 

Comments

05 May 2017 at 12:08
Leonardo wrote...

It worked flawless. I think you should add this information in the part 2 of you tutorial, because it seems like everything related to database ends up in this section. Thank you! Leonardo

05 May 2017 at 12:03
Paul Griffiths wrote...

Hi Leonardo When you begin the umbraco install (during part 4) it will ask you for the database credentials that you created in part 2. Once you provide the details of will automatically update your connection string in your web config. Please let me know if this works or if you have any more problems Paul

05 May 2017 at 12:01
Paul Griffiths wrote...

Hi Simon, I have never had to complete that process in the past. By setting up the website in IIS and configuring the host file to 127.0.0.1 local.installingUmbracoDemo it should work out the box for you. Thanks Paul

03 May 2017 at 22:18
Leonardo wrote...

Hello! Nice tutorial! I have a question. How do you link this database with your Umbraco solution in visualstudio?

28 January 2017 at 17:01
Simon Cropper wrote...

One question - don't you also have to set the Project URL in VS to point to the new Web Site set up in IIS? (Project Properties > Web : change IIS Express to Local IIS and Project URL to the new web site name?

Leave a comment