How to connect to SQL Server database using window

2019-09-07 19:53发布

问题:

I have a simple question, I was granted to a SQL Server database using windows authentication on my local machine, I need to know how to use this access on hosting server as well.

For example I am in the middle of writing some C# code that pulls data from this database, I can run this code on my local machine with my windows authentication no problem, but I can't run it on expected hosting server because that server obviously can't connect to that database.

I was just wondering how can I use windows authentication access remotely?

Thanks

回答1:

Windows authentication must be enabled on the remote server to do this. This can be enabled in server properties > Security and by selecting SQL Sever and Windows Aucthentication radio button. Providing your windows credentials are added to the server then you should be able to login.

On your SSMS right click the database name select properties and select Security from the left hand menu and there you should see the "SQL Sever and Windows Aucthentication" option.

Obviously if your database is not on the same domain then this might not work.