11
votes

I installed MSSQL server 2016 with configuration manager and management studio. I trying connect to SQL server via management studio:

  • Server type: Database Engine
  • Server name: localhost
  • Authentication: Windows Authentication

Error TITLE: Connect to Server:

Cannot connect to localhost. 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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) (Microsoft SQL Server, Error: 2) The system cannot find the file specified

Nothing more information in event viewer. I have these services with states:

  • SQL Server (SQLEXPRESS) - Running
  • SQL Full-text Filter Daemon Launcher (SQLEXPRESS) - Running
  • SQL Server Launchpad (SQLEXPRESS) - Running
  • SQL Server Reporting Services (SQLEXPRESS) - Running
  • SQL Server Agent (SQLEXPRESS) - Stopped
  • SQL Server Browser - Running

After try start SQL Server Agent i get this error:

The SQL Server Agent (SQLEXPRESS) service on Local Computer started and then stopped. Some services stop automatically if they are not in use by other services or programs.

Thank you for any advice.

EDIT

I capture a screen of sql services: enter image description here

2
Might be the installation process is not completely done?Prashant Pimpale
Can you share the screenshot of all the services of SQL Server Agent like :protocols services and ServicePrashant Pimpale
The default instance name of Express, if not changed during setup, is SQLEXPRESS, which means you have to connect to .\SQLEXPRESS.Jeroen Mostert
@PrashantPimpale I have turn on TCP/IP protocol with 443... Now i tried instead of localhost used server name: .\sqlexpress and everything working. I am little bit confused because before reinstal MSSQL i had 2017 and server name was localhost. If i am not wrong i dont change server name. Maybe yes, probably but i am not sure.. BTW thank you so much for your time and advice :)Frantisek Pastorek
Note: SQL Agent is not supported in Express Editions; that service will never run.Dave Cullum

2 Answers

24
votes

I could solve the same issue only with server name (localdb)\MSSQLLocalDB. Just FYI

7
votes

In an attempt to get all the answers in one spot (and hopefully help a future searcher), you can connect to the SQL box that SQL Management Studio is installed on by changing the Server name: in the connection dialog

enter image description here

to one of the following: