Resolving 'Cannot Connect To DataBase Master At SQL Server' Error During SharePoint 2016 Installation

In this article, you will learn how to resolve ‘Cannot Connect to DataBase Master at SQL Server’ error during SharePoint 2016 Installation.

SharePoint Products Configuration Wizard, when run for the first time, creates the Configuration DB and creates a new SharePoint farm. In a higher environment other than dev, it is a mandated practice to maintain two separate severs for Application and Database. SharePoint Products Configuration Wizard runs on the application server where SharePoint is installed. In the Configuration Wizard, we will be specifying the back-end database where the configuration database has to be created. So, there would be a continuous network traffic exchange between the Application Server and the back-end Database Server when the Configuration Wizard is running. When the Configuration Wizard runs for the first time, there are chances that the below error pops up intermittently.

Configuration

In this article, we will see how we can overcome this issue. During the SharePoint Installation, run the SharePoint Products Configuration Wizard and click on Next.

Configuration

Click on Yes to continue.

Yes

We are setting up a new farm, hence, select the radio button ‘Create a new server farm’ and click on Next.

Create a new server farm

Specify the database server name (VM02-SQL2016 in my case) in the field ‘Database Server’. The database access account, used for the configuration, is ‘SPFarmAccount’ which acts as the farm account present in the domain. Click on Next.

SPFarmAccount

However, I ran into the problem, as shown below.

problem

Now, I checked the SQL Server for the account permissions for SPSetupAccount (the account used for installing SharePoint) and it was having ‘DBCreator’ and ‘Security Admin’ privileges as mandated. As per the requirement, ‘SPFarmAccount’ (Farm Account) just needs to be a domain user. During the time of Configuration, the installer automatically grants SPFarmAccount with DBOwner and SecurityAdmin privileges in SQL Server. We don’t have to explicitly grant anything for SPFarmAccount.

Root Cause

After a lot of digging, I found that SQL Server was not allowing any incoming connections. So, we will have to enable it. Let’s see how to do it. Go to the SQL Server (VM02-SQL2016, in my case) and spin up SQL Server 2016 Configuration Manager.

Root Cause

Select SQL Server Network Configuration and click on Protocols for MSSQLSERVER.TCP/IP which is disabled by default. Enable it.

SQL Server Network Configuration

After doing that, we have to write firewall rule that enables the incoming connections to 1433 port which is where SQL Server listens to. Go to Control Panel ->System and Security ->Windows Firewall. Select Advanced Settings option.

System and Security

Click on ‘Inbound Rules’ and select ‘New Rule’ option.

New Rule

This will open up the Inbound Rule Configuration Wizard. Select the radio button ‘Port’ and click on Next.

Port

Select the TCP radio button and specify the port 1433 in Specific local ports text box.

TCP radio button

Specify the action that has to be taken as part of the rule. Select ‘Allow the connection’ radio button.

Allow the connection

In profiles page, select the check box ‘Domain’ and click on Next.

profiles

Specify the name for the Rule and click on Finish.

 Specify the name

Make sure, you restart the SQL Server service for the changes to take effect.

SQL Server service

Now, if we go back to the Configuration Wizard in the SharePoint VM and click on Next, It will proceed to the next page without any exception.

Configuration Wizard

Summary

Thus, we saw how to resolve the ‘Cannot connect to database master at SQL Server’ error that occurs during the installation of SharePoint Server 2016.