Cannot connect to MSSQL server management studio as localhost

g52tjvyc  于 2023-03-11  发布在  SQL Server
关注(0)|答案(4)|浏览(152)

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:

06odsfpq

06odsfpq1#

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

xesrikrc

xesrikrc2#

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

to one of the following:

2sbarzqh

2sbarzqh3#

May be this is familiar to many, but I believe new starters may find this helpful! As similar like above snapshot provided in the problem, I did not find MSSQLSERVER service is showing in SQL Server Configuration Manager. The reason is that I just installed the exe, but failed to do sql server setup actually! To make my 'localhost' as server name with windows authentication works, I followed below steps.

  1. Open SQL Server 2019 Installation Centre. [Note: For SQL Server Installation Media Path, choose location ]. This will open installation Wizard.

  2. Go to Installation -> Choose 'New SQL Server stand-alone installation or add features to an existing installation'

  3. In Installation Type -> Choose 'Perform a new installation of SQL Server 2019'

  4. Follow the instructions and in between the setup, it will prompt to setup password for 'sa'. You can choose either windows mode or mixed mode ( i.e. windows and sql server authentication). [NOTE: This sa password setup will not be prompted during installation from exe.]

  5. Complete the setup.

  6. Once completed, you can see 'MSSQLSERVER' is running.

  7. Just type in 'localhost' with windows authentication by default.

  8. This time, just enter 'localhost' in server name like below

  9. It will then connected immediately without any hassles.

krcsximq

krcsximq4#

Go the given link and download developer edition - once you have installed it, then you would see something like below -

From below picture you can find the server name, that you connect locally. enter image description here

Yo can also refer to my answer on - https://www.quora.com/profile/Sania-Fatimi/Installing-SQL-server-Developer-edition-SSMS-and-connecting-to-localhost-local-server-Go-the-given-link-and-downloa

相关问题