'A connection was successfully established with the server, but then an error occurred during the login process. (Error Number: 233)
I am having error while connecting to SQL Server:
Details in Stack Trace are:
===================================
Cannot connect to ServerName.
===================================
A connection was successfully established with the server, but then an error occurred during the login process. (provider: Shared Memory Provider, error: 0 - No process is on the other end of the pipe.) (.Net SqlClient Data Provider)
------------------------------
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=233&LinkId=20476
------------------------------
Server Name: ServerName
Error Number: 233
Severity: 20
State: 0
------------------------------
Program Location:
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParserStateObject.ReadSniError(TdsParserStateObject stateObj, UInt32 error)
at System.Data.SqlClient.TdsParserStateObject.ReadSni(DbAsyncResult asyncResult, TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParserStateObject.ReadNetworkPacket()
at System.Data.SqlClient.TdsParserStateObject.ReadBuffer()
at System.Data.SqlClient.TdsParserStateObject.ReadByte()
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK)
at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject, Boolean withFailover)
at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart)
at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup)
at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.SqlClient.SqlConnection.Open()
at Microsoft.SqlServer.Management.SqlStudio.Explorer.ObjectExplorerService.ValidateConnection(UIConnectionInfo ci, IServerType server)
at Microsoft.SqlServer.Management.UI.ConnectionDlg.Connector.ConnectionThreadUser()
NOTE I have tried
closing, reopening Sql server Management Studio.
closing , reopen VS & rebuild Solution
killed worker process accessing database.
login credentials are correct.
able to ping server to make sure its not down.
Solution 1:[1]
For SQL2008,
- open Management Studio
- Rt click on instance
- go to properties
- select Security
- Under Server Authentication, check SQL Server and Windows Authentication Mode
- hit OK
Restart the server using configuration manager.
Solution 2:[2]
the following points work for me. Try:
- start SSMS as administrator
- make sure SQL services are running. Change startup type to 'Automatic'
- In SSMS, in service instance property table, enable below:
Solution 3:[3]
For me, adding Trusted_Connection=True to the connection string helped.
Solution 4:[4]
This is what helped me [src]:
File > Connect Object Explorer... > Options (bottom right) > Connection properties tab > Trust Server Certificate tickbox
Solution 5:[5]
In my case I had the following by mistake in my connection string:
Encrypt=True
Changing to
Encrypt=False
Solved the problem
"Server=***;Initial Catalog=***;Persist Security Info=False;User ID=***;Password=***;MultipleActiveResultSets=False;Encrypt=False;TrustServerCertificate=False;Connection Timeout=30;"
Solution 6:[6]
You can also get this error, somewhat unhelpfully, if the database name specified in the connection string doesn't exist. Check your Db Name carefully!
Solution 7:[7]
For MS SQL Management Studio
Options >> connection properties
and check Trust Server Certificate option

Solution 8:[8]
From here:
Root Cause: Maximum connection has been exceeded on your SQL Server Instance.
How to fix it...!
- F8 or Object Explorer
- Right click on Instance --> Click Properties...
- Select "Connections" on "Select a page" area at left
- Chenge the value to 0 (Zero) for "Maximum number of concurrent connections(0 = Unlimited)"
- Restart the SQL Server Instance once.
Apart from that also ensure that below are enabled:
- Shared Memory protocol is enabled
- Named Pipes protocol is enabled
- TCP/IP is enabled
Solution 9:[9]
Solution 10:[10]
Same Error with Connection String in Visual Studio dev environment
I was able to find the solution that worked for me by reading many of the other answers and some of source documentation from those answers. Turns out our development database server was recently given a self-signed certificate so it is automatically untrusted. This resulted in the login error cited above. I added TrustServerCertificate=True to my connection string and it works now.
"Server=TheServerAddress; Database=TheDataBase; User Id=TheUsername; Password=ThePassword; TrustServerCertificate=True"
Solution 11:[11]
SQL 2016 solution/workaround here (could also work in earlier versions). This may not work or be appropriate in every situation, but I resolved the error by granting my database user read/write schema ownership as follows in SSMS:
Database > Security > Users > User > Properties > Owned Schemas > check db_datareader and db_datawriter.
Solution 12:[12]
My problem resolved by this what changes i have done in .net core Do this changes in Appsetting.json
Server=***;Database=***;Persist Security Info=False;User ID=***; Password=***;MultipleActiveResultSets=False;Encrypt=False;TrustServerCertificate=False;Connection Timeout=30
and Do following changes in Package console manager
Scaffold-DbContext "Server=***;Database=***;Persist Security Info=False;User ID=***; Password=***;MultipleActiveResultSets=False;Encrypt=False;TrustServerCertificate=False;Connection Timeout=30;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models -Context DatabaseContext -f
Happy coding
Solution 13:[13]
Solution 14:[14]
Sometimes specifying the database (instead of default) solves this error.
Solution 15:[15]
I got that error message in code line containing SqlConnection.Open() running my .NET code as x64 application. Running as x86 causing no errors.
Solution was to deactivate the Force protocol encryption option for TCP/IP in
%windir%\System32\cliconfg.exe
Solution 16:[16]
I've gotten this error because the user trying to login was lacking permissions.
I don't recommend doing this, but I fixed it by granting the user db_owner globally. It was a local instance, so not a huge security concern.
Solution 17:[17]
To add on top of @Pranav Singh and @Rahul Tripathi answer. After doing all the mentioned by those 2 users, my .net app still wasnt connecting to the database. My solution was.
Open Sql Server Configuration Manager, go to Network configuration of SQL SERVER, click on protocols, right click on TCP/IP and select enabled. I also right clicked on it opened properties, Ip directions, and scrolled to the bottom (IPAII , and there in TCP Port, I did setup a port (1433 is supposed to be default))
Solution 18:[18]
Here is the solution I found:
Go to SQL Server Management, Disable Memory Shared, TCP/IP and Pipes named.
Restart the server and try again.
Solution 19:[19]
I had to do 2 things: Do what Joseph Wu said and change the authentication to be SQL and Windows. But I also had to go to Server Properties > Advanced and change "Enable Contained Databases" to True.
Solution 20:[20]
One of the solutions above gave me a clue. The sa account was generating this exact error. I was able to log in with a Windows service account with admin privileges. At some point recently a GPO had been applied to strengthen the password policy. The existing sa password didn't meet the new strengthened password policy.
Log into SQL Server Management Studio with alternative admin credentials. Instance > Security > Logins > account (sa in my case) Untick "Enforce password policy" Click OK. Disconnect and login again with the account.
Worked for me.
HAd to reboot the server to get various jobs running again but if I took time to go through them I probably could have restarted them from the SSMS without a server restart.
Solution 21:[21]
I had previously limited the number of connections to my DB to 2. Clearly this was an issue. After restarting the server, login, you will get an error popup and just click OK. Right click on the server in the object explorer, go to properties, go to connection and change your limited number of connections (I went from 2 to 20) everything works fine now.
I appreciate this is an old post. But I came across it today, saw lots on MS forums which were incorrect solutions. Almost all of them on here didn't work for me either.
Solution 22:[22]
What helped me is deleting .ldf files from \bin\Debug
Solution 23:[23]
One possible source of this problem is if the database login is not mapped to a user in the database. Solution is of course simple, map the login to the database user.
Solution 24:[24]
Seems like I had a unique situation - other than all the answers posted here.
I connect to the database with a restricted login (mapped to the database user) and NOT the sysadmin sa
Now I restored by database from a copy of another database on the same sql server database (same issue would occur even if you have restored form another sql server database server), but missed to delete the database user and recreated it.
So, essentially, if you are restoring your sql server database here is what you need to do:
Solution 25:[25]
Create the User in Security. Default database will be set to Master After that, you can log in to SQL Server Authentication.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow







