155

I've got this error:

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.)

(Microsoft SQL Server, Error: 233)

I know, there are similar questions on this site, and the answer is, to enable TCP/IP and pipes. But I enabled both, and still doesn't work:

MSSQL error

I am using Microsoft SQL Server 2012 and the user has full permissions.

Sarath Subramanian
  • 20,027
  • 11
  • 82
  • 86
Iter Ator
  • 8,226
  • 20
  • 73
  • 164
  • try pinal dave solutions http://blog.sqlauthority.com/2009/05/21/sql-server-fix-error-provider-named-pipes-provider-error-40-could-not-open-a-connection-to-sql-server-microsoft-sql-server-error/ – GeoVIP Dec 03 '14 at 10:47
  • This worked for me when I reconnected from server authentication to windows authentication. – ganji raajkumar Dec 28 '16 at 13:22
  • 1
    What worked for me (sql express 2016) ... Removing mixed authentication leaving just windows auth, restarting service, switch it back to mixed auth, restart service. until i did this nothing fixed the No process error – Rostol Mar 07 '17 at 01:42
  • 1
    For what its worth, check the connection string in your config file. For me someone had modified one of the server names and checked it in. My code was trying to hit a database that didn't exist on my server. – camainc Dec 11 '18 at 21:31
  • @camainc: I believe Sql Server does not store its connection strings – MSIS Sep 28 '22 at 20:22

21 Answers21

220

The server was set to Windows Authentication only by default. There isn't any notification, that the origin of the errors is that, so it's hard to figure it out. The SQL Management studio does not warn you, even if you create a user with SQL Authentication only.

So the answer is: Switch from Windows to SQL Authentication:

  1. Right click on the server name and select properties;
  2. Select security tab;
  3. Enable the SQL Server and Windows Authentication mode;
  4. Restart the SQL Server service.

You can now connect with your login/password.

Here are the directions by Microsoft: https://learn.microsoft.com/en-us/sql/database-engine/configure-windows/change-server-authentication-mode?view=sql-server-ver15

Iter Ator
  • 8,226
  • 20
  • 73
  • 164
  • 5
    The option was correctly checked, so I checked 'Windows Authentication', I restart the service then I check 'Windows Authentication + SQL Authentication' to fix that problem. So happy! – Groco Sep 04 '17 at 19:39
  • 5
    To clarify @Groco's comment: Log in using `Windows Authentication` >> Right-Click your server >> `Properties` >> `Security` (Under `Select a page`) >> Under `Server Authentication` select `SQL Server and Windows Authentication mode`. Close SQL Server Management Studio, restart the SQL Server service, and try logging in again. – Minh Tran Sep 13 '18 at 21:48
  • 1
    The issue I had was that `Server Authentication` was set to `Windows Authentication mode`. And regardless of the correct password input, I was always greeted with `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.)`. Throughout the error, I was able to log in using `Windows Authentication` – Minh Tran Sep 13 '18 at 21:53
  • thank you so much. reatart the Sql Service fixed my problem. – user1282609 Jul 05 '20 at 01:57
  • 1
    I tried logging in using "sa", and got the same error. – RonJohn Nov 16 '20 at 13:51
  • 1
    For those like me who saw this answer and chased it down also see the answer below "Another reason for this error could be incorrect or non-existent database name.". I chased the Auth Settings and network settings only to find it was the age old "underscore versus dash" issue on the DB name :-{ – Cueball 6118 Jun 02 '21 at 02:23
  • This also fixed the same issue I was having in SQL Server 2019 – nallan Jul 22 '21 at 13:45
65

To solve this, connect to SQL Management Studio using Windows Authentication, then right-click on server node Properties->Security and enable SQL Server and Windows Authentication mode. If you're using 'sa' make sure the account is enabled. To do this open 'sa' under Logins and view Status.

enable sa admin

If this didn't work, you may need to reinstall SQL Server

Iter Ator
  • 8,226
  • 20
  • 73
  • 164
nzchris
  • 659
  • 1
  • 5
  • 3
36

Also you can try to go to services and restart your Sql server instanceenter image description here

No Name
  • 719
  • 6
  • 14
35

So, I had this recently also, for integrated security, It turns out that my issue was actually fairly simple to fix but mainly because I had forgotten to add "Trusted_Connection=True" to my connection string.

I know that may seem fairly obvious but it had me going for 20 minutes or so until I realised that I had copied my connection string format from connectionstrings.com and that portion of the connection string was missing.

Simple and I feel a bit daft, but it was the answer for me.

Joe Walters
  • 641
  • 6
  • 7
  • 2
    I tried all comments but it didn't work. Your solution worked perfect for me. Thank you very much. – Zhong Ri Feb 06 '19 at 18:10
  • this was the last thing that I tried after all the other stuff of checking tcp is enabled, adding mixed mode authentication and restarting sql browser service and it worked. thanks – Myke Black Sep 17 '19 at 08:14
18

Another reason for this error could be incorrect or non-existent database name.

Forcing the TCP/IP connection (by providing 127.0.0.1 instead of localhost or .) can reveal the real reason for the error. In my case, the database name specified in connection string was incorrect.

So, here is the checklist:

  • Make sure Named Pipe is enabled in configuration manager (don't forget to restart the server).
  • Make sure the database you are connecting to exists.
  • Make sure SQL Server Authentication (or Mixed Mode) is enabled.
Mohammad Dehghan
  • 17,853
  • 3
  • 55
  • 72
  • what happened to configuration manager in express 2016? I don't see it available? Oh I have to run SQLServerManager13.msc now – Kirsten Jan 20 '18 at 07:16
  • 1
    When I changed to 127.0.0.1 I got error message Message=A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) Source=Core .Net SqlClient Data Provider – Kirsten Jan 20 '18 at 07:26
  • 1
    @kirsteng Check your installed SQL Server instances. Did you install a default instance (MSSQLSERVER)? – Mohammad Dehghan Jan 20 '18 at 10:16
  • The SQL Server Authentication in mixed mode did it for me. Guys if you do a fresh installation of SQL Server Express, when you want to add a user for your progamming needs, you need to change it to mixed mode otherwise only windows authentication will be avilable. – Eduardo Sep 02 '18 at 12:24
  • This (sort of) worked. Once I changed the localdb nonsense to 127.0.0.1 it got through. – Eric Nov 27 '18 at 19:59
  • It was the database name for me. There was nothing else for me to do except fix the name. I think that should be emphasized here. I will attempt to fix that. – Sam Hobbs Feb 16 '20 at 20:42
  • I was doing a DevExpress XAF Blazor tutorial. That documentation says that the framework will create the Db the first time it runs. Ha. Once I created both the primary Db and the "EasyTest" Db the app ran. Thanks MD. – pdschuller Dec 20 '20 at 02:32
9

Please check this also enter image description here Also check in configuration TCP/IP,Names PipeLine and shared memory enabled

Muhammad Bilal
  • 1,008
  • 13
  • 14
8

If you are trying to login with SQL credentials, you can also try changing the LoginMode for SQL Server in the registry to allow both SQL Server and Windows Authentication.

  1. Open regedit
  2. Go to the SQL instance key (may vary depending on your instance name): Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL14.SQLEXPRESS\MSSQLServer\
  3. Set LoginMode to 2

enter image description here

  1. Restart SQL service and SQL Server Management Studio and try again.
gotorg
  • 147
  • 1
  • 10
5

I face this issue for the second time and all previous answers failed, fortunately the following request do the job:

Alter login [user] with CHECK_POLICY = OFF
go

Alter login [user] with CHECK_POLICY = ON
go
Groco
  • 1,301
  • 15
  • 19
5

For me the password expired for my login user, and i got the same exception. Then i login with Windows Authentication mode and change the password for the associated user, and it solved my problem.

Bence Végert
  • 728
  • 10
  • 12
5

Yup, this error might as well be "something failed, good luck figuring out what" - In my case it was a wrong username. SQL Server 2019 RC1.

Anssssss
  • 3,087
  • 31
  • 40
3

Had this error too, the cause was simple, but not obvious: incorrect password. Not sure why I didn't get just "Login failed" from freshly installed SQL 2016 server.

Stefan
  • 59
  • 5
2

I have the same proplem "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.)"

My connection is:

server=POS06\SQLEXPRESS; AttachDbFilename=C:...\Datas.mdf;Initial Catalog= Datas; User ID= sa; Pwd=12345; Connect Timeout=10;

But My SQL is POS06\MSQL2014

Change the connection string to

server=POS06\MSQL2014 ; AttachDbFilename=C:...\Datas.mdf;Initial Catalog= Datas; User ID= sa; Pwd=12345; Connect Timeout=10;

it worked.

Doan bien
  • 21
  • 1
2

Always try to log in using those credentials with SQL Management Studio. This might reveal some more details that you don't get at runtime in your code. I had checked the SQL + Windows authentication, restarted the server but still no luck. After trying to log in using SQL Management, I got this prompt:

screenshot

Somehow the password had expired although the login was created just minutes before. Anyway, new password set, connection string updated and all's fine.

CyberDude
  • 8,541
  • 5
  • 29
  • 47
2

This might help others. After writing my db routines at home, all working fine. Brought it to work and got this error as well. Might assert same error, different reason. I mistyped the database name when fixing up my code. Ooohh! More coffee ;) Looking back now, kind of makes sense in my case the login/user was good (an admin account) but with a bad database name, there was nothing on the end of the pipe. Why not say "Database does not exists...? And be clear.

Dano
  • 112
  • 7
1

make sure that you have specified user in Security-> Logins, if no - add it and try again.

elkoo
  • 704
  • 9
  • 23
1

Follow the other answer, and if it's still not working, restart your computer to effectively restart the SQL Server service on Windows.

Eric Aya
  • 69,473
  • 35
  • 181
  • 253
cschaefer
  • 259
  • 4
  • 8
  • You can also usually restart the SQL service for your specific database by locating it in `services.msc` – Zimano Nov 01 '19 at 11:51
1

In my case the database was restored and it already had the user used for the connection. I had to drop the user in the database and recreate the user-mapping for the login.

  1. Drop the user

    DROP USER [MyUser]
    

It might fail if the user owns any schemas. Those has to assigned to dbo before dropping the user. Get the schemas owned by the user using first query below and then alter the owner of those schemas using second query (HangFire is the schema obtained from previous query).

select * from information_schema.schemata where schema_owner = 'MyUser'
ALTER AUTHORIZATION ON SCHEMA::[HangFire] TO [dbo]     
  1. Update user mapping for the user. In management studio go to Security-> Login -> Open the user -> Go to user mapping tab -> Enable the database and grant appropriate role.
Baga
  • 1,354
  • 13
  • 24
1

In my case: Assign a sysadmin role to the user.

  1. Login as windows authenticated user
  2. Go to: Security->Login->Right click user->Assign server role as sysadmin
  • Talk about a "sledgehammer approach" - this dangerous and should not even be considered as a solution. – Rab Mar 17 '21 at 15:17
1

In my case, login works fine remotely, via VPN. But connecting from the server where sql server was installed, it failed.

Turns out, the instance name is not the default eg. SQLEXPRESS. Hence, it needs to be explictly specified when connecting.

enter image description here

enter image description here

Server name: .<instance_name> eg. ".\I01"

I don't have to do this if I'm connecting remotely, just <server_hostname>,<port_number>

tinker
  • 483
  • 4
  • 16
1

In my case the Database was not created yet (not existent), but the error in EF Core 7.0.3 was

"No process is on the other end of the pipe"

Omu
  • 69,856
  • 92
  • 277
  • 407
0

Right-Click your server name >> Go to Properties >> to Security >>Under Server Authentication >> select SQL Server and Windows Authentication mode >>restart the SQL Server service, and login.