Issue with Making an Encrypted Connection to SQL Server with SQL Management Studio (SSMS)

Issue

You encounter the following errors/issues when connecting through SQL Server Management Studio (SSMS).

SQL Secure Connection Error 1

A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 0 - The target principal name is incorrect.) (.Net SqlClient Data Provider)

Cause of issue

This error happens when the installed SSL certificate's common name doesn't match the name you used.

How to Resolve Issue

To resolve the issue, use the correct SQL hostname as shown in the control panel's MS SQL Manager.

SQL Secure Connection Error 2

A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 0 - The certificate chain was issued by an authority that is not trusted.) (.Net SqlClient Data Provider)

Cause of Issue

This error happens because we are using a self-signed certificate on our SQL server for encrypted connection.

How to Resolve Issue

To resolve the above issue, you can select the "Trust Server Certificate" option in SSMS connection settings.