Cannot log in using SQL authentication ONLY from a remote server

怎甘沉沦 提交于 2019-12-10 17:47:37

问题


I am trying to connect to SQL Server 2008 from a remote server using 'sa' username and its password (I can log in normally with this username and password from my own computer - so "SQL Server and Windows authentication mode" is chosen).
In the SQL Server log file on my computer I see this error:

Login failed for user 'sa'. Reason: An attempt to login using SQL authentication failed. Server is configured for Windows authentication only.

I thought it might be a remote connection problem, so I checked that the remote connection in the properties is enabled, in the configuration manager I enabled TCP/IP and Shared Pipes and restarted the service afterwards and I created a firewall rule for port 1433. I also tried to turn off the firewall in case that it is being blocked somehow, but I got the same error.

How this error appears only when accessing SQL Server from a remote server?
How can I fix it?


回答1:


From the SQL Server management studio, right click on your server (after connect) in the Object Explorer window and choose Properties.

On Security item, make sure that SQL Server And Windows Authentication mode is selected.




回答2:


The most obvious solution for me seems to allow SQL Server authentication on the server if it's really necessary to use sa for access (what it should not normally).

To answer the "why" we need more information. Which program do you use to access the server. Is the connection string really identical for both accesses?

Just guessing: From your local machine you use integrated security=true somehow (which causes user and password to be ignored), and your local windows user is allowed to access the server. From remote you use integrated security=false so that you can't logon using user/password, as the server is configured to only accept Windows authentication.




回答3:


I had the exact same problem today. I was not able to connect to SQL server remotely using username/password, but it worked with windows authentication, and logging in locally also worked.

The reason it didn't work here was that I was using a password that was too short on the sa user. Apparently it does enforce password policy if logging on locally, but remote connections are blocked.

You can either change the password to a longer/more complex one, or disable the password policy enforcement for the sa user.

Short how-to: In SQL Server Management Studio, open Security -> Logins, find "sa" -> Properties -> Change password or uncheck this box:




回答4:


In my situation, I have SQL Server 2008 and SQL Server 2012 installed. So, in server name field, I need a concrete name (for example: 10.141.133.125\SQLServer2012). That's it!

Hope this useful for you!



来源:https://stackoverflow.com/questions/8442163/cannot-log-in-using-sql-authentication-only-from-a-remote-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!