SharePoint 2019: Cannot connect to database master at SQL server

Cannot connect to database master at SQL server SharePoint 2019

In this post, we’re going to fix “Cannot connect to database master at SQL server SharePoint 2016 and SharePoint 2019”

SharePoint Configuration Wizard: Cannot connect to database master at SQL server SharePoint 2019. The database might not exist, or the current user does not have permission to connect to it.

Cannot connect to database master at SQL server at SERVERNAME. The database might not exist, or the current user does not have permission to connect

Applied To

  • SharePoint 2019.
  • SharePoint 2016.
  • SharePoint 2013.
  • SharePoint 2010.

You might also like to read, SharePoint Configuration Wizard: Cannot connect to database master at SQL server at SERVERNAME. The database might not exist, or the current user does not have permission to connect.


Cannot connect to database master at SQL server

I am trying to configure a new SharePoint 2016/2019 farm for the first time.

The SharePoint installation is done successfully, but when I tried to run the SharePoint configuration wizard and went to the “Configuration Database Settings” to provide the following:

  • SQL Server Instance.
  • Database Name.
  • Farm Account.
SharePoint Configuration wizard - Configure Database Settings

I got the below error

Cannot connect to database master at SQL server SharePoint 2016. The database might not exist, or the current user does not have permission to connect to it.

Cannot connect to database master at SQL server at SharePoint 2016

You might also like to read SQL Server Best Practices for SharePoint 2019


SharePoint Configuration Database Settings Check List

There are a lot of root causes for this issue that I already mentioned in details at this article “Cannot connect to database master at SQL server at SERVERNAME“.

I also performed the below checklist to avoid the “Cannot connect to database master at SQL server SharePoint 2016″ issue during configuring the SharePoint database settings in the SharePoint Configuration Wizard.

  • The provided farm account must have sufficient permission on the SQL server instance,
    • Database Creator.
    • Security Admin.
server roles for farm account in SharePoint
  • The SQL Server Service is up and running.

Check also, SQL Server service is not starting!

  • The SQL Server Agent is started.
  • The SQL Server Browser Service is started.
SQL Server is up and running
  • The database server is reachable and the SQL server port is opened (1433).

Check also, How to Check SQL Server Instance Connectivity from the application server to database server for a specific user.

  • The Windows Firewall is Off.

If the Windows Firewall is On, please make sure that you are allowed an inbound rule for SQL Server on port 1433 as mentioned at Cannot connect to database master at SQL server at SERVERNAME.

  • The TCP/IP network configuration for the SQL Server instance is enabled.
SQL Server Network Configuration

Cannot connect to database master at SQL server SharePoint 2016

Solution

Although I have provided the farm account the required permission and I also checked all the above configurations checklist, but I am still facing “Cannot connect to database master at SQL server issue!

After performing a quick investigation, I realized that the issue was related the current login service account permissions.

The current login user that you are using to run the SharePoint configuration wizard must have sufficient permissions on the SQL instance to can create a database.

Logins User in SQL Server

SQL Server Permissions required for SharePoint Setup Account

So, to overcome “Cannot connect to database master at SQL server“, you should provide the current login account that you are using to run the SharePoint Configuration Wizard the below SQL server roles:

  • “dbcreator”,
  • “security admin”.

You might also like to read SharePoint 2019: Service Accounts Recommendations

Steps
  • Open SQL Server Management Studio.
  • Below “Security” > Logins > New Login.
Security Settings in SQL Server for SharePoint
  • Click on Search button to add the current login user.
the server roles for the SharePoint Setup Account
  • In “Locations”, select the “Entire Domain”.
  • Provide the account that you are using to run the SharePoint Configuration Wizard.
  • Click “OK”.
Add user to SQL Server
  • From the left side, Click on “Server Roles”.
  • Check the below roles
    • dbcreator.
    • securityadmin.
server roles for farm account in SharePoint
  • Go back to login with this account to the server.
  • Run the “SharePoint Configuration Wizard“.
  • At “Configuration Database Settings“, specify the required information.
  • Click “Next”.
SharePoint Configuration wizard - Configure Database Settings
  • The SharePoint Configuration wizard should working now and you will be ready to specify “Farm Security Settings“.
Specify Farm Security Settings - Cannot connect to database master at SQL server

If the above instructions didn’t help you to solve your issue, I advise you to check this detailed article: SharePoint Configuration Wizard: Cannot connect to database master at SQL server at SERVERNAME. The database might not exist, or the current user does not have permission to connect.


Conclusion

In conclusion, we have solved “Cannot connect to database master at SQL server” issue that you may face during configuring a new SharePoint 2016/2019 farm.

We have learned, If the current login account that you are using to run the configuration wizard differs from the farm account, so you must also provide this login accoun the below server roles in SQL Server instance as the following:

  • DB Creator.
  • Security Admin.
See Also
Have a Question?

If you have any related questions, please don’t hesitate to ask it at deBUG.to Community.

4 thoughts on “SharePoint 2019: Cannot connect to database master at SQL server”

Leave a Reply