I have a machine which could connect to an MS SQL Server in the past. I have SSMS installed and the connection was possible when I activated TrustServerCertificate checkbox in SSMS. I could connect and see databases and tables and execute statements etc...
Later I tried to scaffold models with entity framework with the command:
dotnet ef dbcontext scaffold "Server=xxx;Database=yyy;User Id=zzz;Password=abcd;TrustServerCertificate=true;" Microsoft.EntityFrameworkCore.SqlServer --table xxx.yyy
There was a prompt which said i could create or install (I cant remember which it was) a certificate. I accepted the prompt and after that the connection is not possible anymore. Even with SSMS the connection is not possible anymore.
I think entity framework or the machine has created a certificate and now the connection is not possible because the created certificat is not trusted by the sql server.
How do i get the connection working again?
If i try to connect via SSMS i get the message:
Cannot connect to xxx.
------------------------------ ADDITIONAL INFORMATION:
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.) (Microsoft SQL Server, Error: -2146893019)
For help, click: https://docs.microsoft.com/sql/relational-databases/errors-events/mssqlserver--2146893019-database-engine-error
The certificate chain was issued by an authority that is not trusted
If i activate trust server certificate the following message is shown:
Cannot connect to xxx.
------------------------------ ADDITIONAL INFORMATION:
Login failed for user 'zzz'. (Microsoft SQL Server, Error: 18456)
For help, click: https://docs.microsoft.com/sql/relational-databases/errors-events/mssqlserver-18456-database-engine-error
How can i remove this certificate? Where is it stored on the machine? How can i connect again? I have no acces to the remote SQL Server.
I did not find any certificate in "computer certificates" or "user certificates" on the windows machine which may be indicating that this was the created certificate. There are so many installed certificates on this machine.
Thanks in advance