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.
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.
Click on Yes to continue.
We are setting up a new farm, hence, select the radio button ‘Create a new server farm’ and click on Next.
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.
However, I ran into the problem, as shown below.
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.
Select SQL Server Network Configuration and click on Protocols for MSSQLSERVER.TCP/IP which is disabled by default. Enable it.
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.
Click on ‘Inbound Rules’ and select ‘New Rule’ option.
This will open up the Inbound Rule Configuration Wizard. Select the radio button ‘Port’ and click on Next.
Select the TCP radio button and specify the port 1433 in Specific local ports text box.
Specify the action that has to be taken as part of the rule. Select ‘Allow the connection’ radio button.
In profiles page, select the check box ‘Domain’ and click on Next.
Specify the name for the Rule and click on Finish.
Make sure, you restart the SQL Server service for the changes to take effect.
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.
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.