Not able to connect to local SQL Server 2008 - sql

I have just recently downloaded and installed SQL Server 2008 on my laptop. I want to login using my local details.
I tried like this in my image below
but I get this error:
Kindly let me know how to connect it as I am new for doing first time installation.

There are many reasons..few listed below
Instance name may be incorrect..So try searching for all the available instances ..when you are connecting from local ,you can check that easily by try clicking on server name drop down and browse for more and clicking database engines
Once instance name is correct, you can try checking if SQL Server services are running by opening configuration manager
If SQL Server is running , you may want to check if network protocols are enabled in same configuration manager
One more reason could be SQL Server browser service not running..this helps you to connect to right instance when you have multiple instances running on same box and you don't specify port number while connecting

Do the following to troubleshoot:
Go into sql server connection manager and check if sql server services is running. If it is not running then start it.
If it is running, right click it and open it.
Copy name of instance from and paste that name in management studio connection window.
If you still get error try connecting it with ‘.’ In server name in ssms connection window.
If its still not working, go in sql server connection manager and check protocols. Check if named pipe protocol is enabled. If not enabled, enable named pipe protocol.
If you follow above steps you should fix the error you are getting.

Related

I can't open SQL Server 2014 "Cannot connect to server"

After setup I can't open my SQL Server Management Studio:
TITLE: Connect to Server
Cannot connect to 0.
ADDITIONAL INFORMATION:
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: 53)
The network path was not found
In my case what it worked for me was the Hosts file in the folder C:\Windows\System32\drivers\etc
I was trying to connect into a SQL server with a name that has an entry in the HOSTS file; however, the IP in the HOSTS file was unreachable - Nonexisting -
First, I connected using my SQL client using the IP address and it was no problem.
Next, I delete the entry for the SQL server name in the HOST file in the folder C:\Windows\System32\drivers\etc, saved it and again tried to connect into that SQL server using the name that I just deleted from the host file and it went thru without issues.
I hope it helps someone along the way
It happened for me, but it is nor serious problem. If database is in your local, may be u must boot IIS or SQLEXPRESS manually in Services of Windows.
And may be, you are writing incorrect name.
You can try the following:
In Windows, go to Services >> SQL Server related to your instance >> Right Click >> Start
Again in Services >> SQL Server AGENT related to your instance >> Right Click >> Start
Try connecting the instance again using SSMS.
Regards,
Pratik
The error message is saying Cannot connect to 0. That 0 is where it would normally give the name of the instance it was trying to connect to. Which implies that you gave it 0 as the name of the SQL instance to connect to, which is never going to work.
You need to give it the name of the machine where the SQL server service has been installed (or use shortcuts like . or localhost to represent the current machine) and if the instance name was not the default instance name, you need to follow the machine name with backslash and the instance name.
If you want to connect to the local instance via SQL Server Management. You can expand the server name box and click the . Then you can browse the local servers via expand the "Database Engine". Please click the instance name which you want to connect so that you can avoid fat figures.
Browse for Servers
Besides, if you want to connect to the default instance on the local computer, please specify the server name as "localhost" or " . ". For detailed information, please refer to the document.
https://learn.microsoft.com/en-us/sql/database-engine/configure-windows/logging-in-to-sql-server?view=sql-server-2017

Cannot login to sql server 2008 R2 after rebooting server

I am using Windows-server-2008 with Microsoft SQL Server 2008.
And there are a lot of questions about this, but nothing on the internet solved it.
The problem is that i can't connect to the my SQL Server 2008 R2 after rebooting my server.
I placed some new memory in my server, and after rebooting my client/server application didn't work anymore because it cannot reach the database.
So i tried to get in SQL Server Management Studio (SSMS), and tried to loggin with Administrator and another user but both do not work.
When i logg in the following message is displayed:
Cannot connect to (local)
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)
I Tried a lot of different things like:
Rebooting server
Try to start the server manually from Sql Server Configuration Manager
Named Pipes - Enabled
TCP/IP - Enabled
Tried to create an new system user or database user as described in the following article: Click Here
Can somebody please help me? I am really confused because i need to get this online. Otherwise i have to reinstall the database server but i do not have a back-up. (is there some folder with a back-up of the settings/tables/columns are stored and can be imported from reinstall?
I was having the exact same problem. net start mssqlserver was giving me the blurb about a failed login attempt. The problem was that I had recently changed the password for the administrator account, and the new password didn't get updated in services.
Here's how I fixed it:
First locate SQL Server from the list here:
Right click and select properties, and navigate to the Log On tab:
Then I typed the new password, and like magic I was able to start SQL Server right through the services manager.
I also did this for any other processes which were marked as "stopped" even though Startup Type was marked as "automatic" (namely, SQL Server Agent).
Is it a named instance or default? Also, is this a local instance? (I see the "(local)" but just wanted to make sure.)
Start the sql server services from services.msc and try to connect

Cant connect to SQL Server 2005 localhost

I've been trying to connect to SQL Server 2005 on my localhost and I can not connect...
Server name: (local)\SQLEXPRESS Authentication: Windows
Authentication
other Server name I have tried are
LOCALHOST\SQLEXPRESS
(local)\my local hostname
I get this error message:
Cannot connect to 127.0.0.1\SQLEXPRESS. 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.
SQL Server Browser is turned on in Services
any ideas?
(1)
You need to verify (not just guess) that the SQL Server service is running. You can do this by going to Start > Control Panel > Administrative Tools > Services, and checking that the service SQL Server (SQLEXPRESS) is running. If not, start it.
(2)
While you're in the services applet, also make sure that the service SQL Browser is started. If not, start it.
(3)
You need to make sure that SQL Server is allowed to use TCP/IP or named pipes. You can turn these on by opening the SQL Server Configuration Manager (found under Start > Programs > Microsoft SQL Server 2005 > Configuration Tools), and make sure that TCP/IP and Named Pipes are enabled. Here my instance name is different but you can see that both of these protocols are disabled (you'll want to check under Protocols for SQLEXPRESS):
(You'll need to restart the SQL Server service if you change these settings.)
(4)
While it is no longer used in current versions of SQL Server, you'll also want to check the Surface Area Configuration tool. This is also found under Start > Programs > Microsoft SQL Server 2005 > Configuration Tools. Click on "Surface Area Configuration for Services and Connections", then highlight SQLEXPRESS (again my local instance name is SQL2005 but pretend it's the same as yours), and under Database Engine > Remote Connections, enable "Local and remote connections" for the option "Using both TCP/IP and named pipes." In the screen shot below I only have TCP/IP enabled. If you change these settings, hit Apply, and again you'll need to restart SQL Server for the changes to take effect.
(This won't help your current problem but you may need to enable this if you want to connect to SQL Server from other machines, and it may also help future readers who are trying to connect to SQL Server 2005 remotely.)
(5)
It may also help to shut off Windows Firewall temporarily, in case you are blocking yourself somehow. (Control Panel > Windows Firewall)
(6)
Review SQL Server's error log. You can get to this file at a path something like:
C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\LOG\
(I don't have an Express instance handy so the path might be slightly different on your machine.)
Now, in that folder there will be a file called ERRORLOG... this is the most recent log file that was generated the last time SQL Server started. You can right-click this file and choose Open With... select notepad. You should see some lines like this:
2012-05... Authentication mode is MIXED....2012-05...
Server name is 'something\SQLEXPRESS'. This is an informational
message only. No user action is required....2012-05... Server
local connection provider is ready to accept connection on [
\.\pipe\SQLLocal\SQLEXPRESS ].2012-05... Server local
connection provider is ready to accept connection on [
\.\pipe\MSSQL$SQLEXPRESS\sql\query ].2012-05... Server is
listening on [ ::1 49164].2012-05... Server is listening
on [ 127.0.0.1 49164]....2012-05... SQL Server is now
ready for client connections. This is an informational message; no
user action is required.
Please tell us which of these lines you don't see, and what the second line says where I wrote "something\SQLEXPRESS".
If You have installed VS2008 then re-install sqlexpress2005 part once more or additionally you need to install that one then it will automatically fix its server name.
Make sure you have enabled the client protocols using the SQL Server Configuration Manager.

Unable to connect to SQL Express "Error: 26-Error Locating Server/Instance Specified)

I am at an loose end with one particular box that is running SQL Server 2008 R2 Express.
Windows Firewall is configured to allow inbound TCP & UDP 1433, 1434.
Windows Firewall is configured to allow outbound TCP & UDP on any port.
No other software AV/FW is currently running.
When I try to connect to xxx.xxx.xxx.xxx\sqlexpress, it times out with the following error:
TITLE: Connect to Server
Cannot connect to xxx.xxx.xxx.xxx\SQLEXPRESS.
ADDITIONAL INFORMATION:
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) (Microsoft SQL Server, Error: -1)
I have checked that remote connections are allowed on the server.
I have confirmed TCP/IP is enabled and configured in SQL Server Configuration to allow connections on the external IP to 1433.
I have also used Wireshark from my local machine and I can see requests for 1433 UDP going to the remote server.
But using Wireshark on the remote server shows no inbound connection requests for 1433 UDP or anything from my external IP (with filtering to remote RDP from results).
This makes me think it is a firewall issue.
The server is hosted by an external company who have control over the PIX in front of our server.
I need to troubleshoot this as much as possible myself as the hosting company have no clue what they are doing.
I had a similar problem which was solved by going to the "SQL Server Configuration Manager" and making sure that the "SQL Server Browser" was configured to start automatically and was started.
I came across this solution in the answer of this forum post:
http://social.msdn.microsoft.com/Forums/en-US/sqlexpress/thread/8cdc71eb-6929-4ae8-a5a8-c1f461bd61b4/
I hope this helps somebody out there.
press windows+R open RUN Window
services.msc
find SQL Server(SQLEXPRESS) right click on that and start the service
then check
Go to SQL Server Configuration Manager > SQL Server Services > In Right Side window show all the servers which may stop. If you are using "SQLEXPRESS" then ,
Right click on SQL Server(SQLEXPRESS) and start. After try to connect server... I had same problem but I resolved by these steps.
Here is a simple method to troubleshoot connection issues:
Create an empty file called test.udl using a text editor
Double click the file test.udl, then specify your connection properties
Hit the "Test Connection" button.
I recently encountered the same issue however I am using Windows 10 Technical Preview Build 10041 and SQL Server 2014 (Advanced).
Follow the same advice from above:
In particular, my problem was that I did not enable the TCP/IP in Sql
Server Configuration Manager->SQL Server Network
Configuration->Protocols for SQLEXPRESS.
Once you open it, you have to go to the IP Addresses tab and for me,
changing IPAll to TCP port 1433 and deleting the TCP Dynamic Ports
value worked.
Follow the other steps to make sure 1433 is listening (Use netstat -an
to make sure 0.0.0.0:1433 is LISTENING.), and that you can telnet to
the port from the client machine.
Finally, I second the suggestion to remove the \SQLEXPRESS from the
connection.
AND ----> That last line is important! It looks like to be Windows 10 specific; remove \SQLEXPRESS from your connection string. What was frusting was that SQL Management Studio connects just fine using either connection string (full or short), however Visual Studio only accepted the connection string without the \SQLEXPRESS.
The active firewall on the server might be causing this. You can try to (temporarily) turn it off and see if it resolves the issue.
If it is indeed caused by the firewall, you should allegedly be able to resolve it by adding an inbound rule for TCP port 1433 set to allowed, but I personally haven't been able to connect this way.
I had a Same Problem but i solved by Restarting the browser service in SQL CONFIGURATION MANAGER and removing \SQLEXPRESS from the instance name in the connection window.
It's security all about. Make sure you have double check your firewall (windows and anti virus) in some cases when you disabled av firewall and restart your computer, automatically windows firewall is active and it's still block your application. Hope this is helpful ..
Could you post the connection string you're using that's giving you trouble?
You might need to add the port number to the Data Source value, as omitting it can also produce SQL Error 26.
E.g.: Data Source=ServerHostName\SQLServerInstanceName,1433
If you have done anything but in spite of all couldn't connecting?!!
In my case i have changed connection part splitting port "," instead of this ":"
The corresponding TCP port or pipe name is not specified in the connection string (such as Srv1\SQL2008, 1433).
This issue also confused me a few days, after the IT guy changed some security settings on the SQL Server.
I have an EntityFramework for the Web application and for a desktop application.
After I changed some settings on the SQL Server, the Web application comeback to work, but the desktop still facing issue. But I used the same connection string for both applications, it make no sense one is working but the other doesn't.
Then I searched a lot until I found someone saying here it is needed to add port number 1433 after the $ServerName\$DatabaseInstanceName,1433.
After I added it, the exception became:
System.Data.SqlClient.SqlException: Login failed for user
'domain\name-PC$'
Then I found this link. It says to add Trusted_Connection=False;.
The whole connection string should be like:
data source=XXXXX\SQLSERVER,1433;initial catalog=XXXDB;user id=UserID;password=PWD;Trusted_Connection=False;MultipleActiveResultSets=True;
Hope this answer will help the ones out off Generic exception:
Error: 26-Error Locating Server/Instance Specified
Have you Disabled the VIA setting in the SQL configuration manager? If not, do disable it first (if VIA is enabled, you cannot get connected) and yes TCP must be enabled. Give it a try and it should be working fine.
Make the changes only for that's particular instance name.
Cheers!
I found this url to be very useful:
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/2cdcab2e-ea49-4fd5-b2b8-13824ab4619b/help-server-not-listening-on-1433
In particular, my problem was that I did not enable the TCP/IP in Sql Server Configuration Manager->SQL Server Network Configuration->Protocols for SQLEXPRESS.
Once you open it, you have to go to the IP Addresses tab and for me, changing IPAll to TCP port 1433 and deleting the TCP Dynamic Ports value worked.
Follow the other steps to make sure 1433 is listening (Use netstat -an to make sure 0.0.0.0:1433 is LISTENING.), and that you can telnet to the port from the client machine.
Finally, I second the suggestion to remove the \SQLEXPRESS from the connection.
EDIT: I should note I am using SQL Server 2014 Express.
This really Works .. i had verified lot of sites and finally got the answer
This may occurs when the master.mdf or the mastlog.ldf gets corrupt . In order to solve the issue goto the following path
C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL , there you will find a folder ” Template Data ” , copy the master.mdf and mastlog.ldf and replace it in
C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA folder .
Thats it . Now start the MS SQL service and you are done .
While there can be many reasons for this error - In my case it was pretty simple which I overlooked for a while. I was using server IP address along with instance name for Server as -
<add name="MyDBConnection"
connectionString="Persist Security Info=False;User ID=sa;Password=xxx;Database=MyDB;Server=nn.nn.n.nn\SQLInstance01; Connection Timeout=180" providerName="System.Data.SqlClient"/>
Correct connection string will look something like this (note this one doesn't have SQL Server instance name)
<add name="MyDBConnection"
connectionString="Persist Security Info=False;User ID=sa;Password=xxx;Database=MyDB;Server=nn.nn.n.nn; Connection Timeout=180" providerName="System.Data.SqlClient"/>
HTH.
In my case, I Installed SQL Express 2012 and the problem raise after I reboot my PC. I solved so:
I go to Services -> SQL Server (SQLEXPRESS) and I see that was stopped. I started and It's say an login error.
In properties, Tab Log On, I change it to Local System account , then I can start the SQL service.
Then to test it, I go to SQL Server Management Studio and I connect to .\SQLEXPRESS and it works!
I had a similar problem which was solved by going to the "SQL Server Configuration Manager" and making sure that the "SQL Server Browser" was configured to start automatically and was started.
it works for me
I got a similar problem with sql server , I have tried every thing but does not connect to database engine & it shows error:26.
First check if the database engine is running or not. by going into
configuration manager. start > sql server >sql server configuration
manager. On the right pane you should see the sql server (mss .. )
should be running state with a green indication.
IF the database engine is not running, simply uninstall sql
server / format your system if possible and then download sql
server 2012 and management studio. from
https://www.microsoft.com/en-ca/download/details.aspx?id=29062
Install server first, make sure to add server on installation phase
by clicking add server and then install management studio.
All you need to do is to go to the control panel > Computer Management > Services
and manually start the SQL express or SQL server.
It worked for me.
Good luck.

When trying to access a SQL Server 2008 server in my domain, I get a "server not found or was not accessible" error

When setting up a system that requires a remote computer to access SQL 2008 stored on another computer in the same domain, I'm running into the following error:
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.
When I installed SQL Server, I was sure I set up the system just so. How can I troubleshoot this?
I appreciate this thread is old now and already has an accepted answer, but I found a slightly different solution with regards to this issue that others may find useful. From reading this issue description I found that there were two SQL Server services in the standard Windows Local Services control panel: MSSQLSERVER and SQLEXPRESS (see below).
I found that SQLEXPRESS was running, but MSSQLSERVER was not. So I simply started that service, and I was able to connect to SQL Server again.
A couple of things to try...
check the Configuration settings to ensure that the TCP protocol is enabled.
try accessing the remote server via IP instead of the server name, this has worked for me in the past (oddly).
I'm assuming its running on the default port, if it isnt then you will need to specify the port number after the server-name / ip separated by a comma:
sql-server-name,{port}
Look at the name of the SQL server instance and make sure it is what you are using to connect to it. Also, look at the SQL Server Network Configuration under Configuration Tools. I worte an article about a very similar problem (if not the same) here:
Having had this a few times even with named pipes the first thing I always try is pre-pending the server name before the named instance; so SERVER\namedinstance. You can manually overwrite the dropdown values in the connect . So ideally in the setup it should have a brief tip below the named instance box like Enter SERVER\namedinstance. Although knowing MS if you entered this you'd probably end up with SERVER\SERVER\namedinstance...!
You can also use the browse option (bottom of server dropdown) and if you're lucky it may be in the 2nd tab (Network Servers) - even if it's a local install.
The program you are running needs to be running under an account which has access to the network (and depending on protocol chosen, may need access to the SQL Server by role or whatever). This error indicates that it is not finding the server on the network by name or IP.
The most common case I have seen this is when you have a web app running under a local account which does not have network access attempting to access SQL Server on another machine.
If you have access to the server that SQL Server is running on, you can try:
-Opening SQL Server Configuration Manager
-In the left pane, click 'SQL Server Network Configuration' and then 'Protocols for [instance name, possibly SQLEXPRESS]'
-Right click TCP/IP again and you'll see the port used. Mine was listed under IPAll/TCP Dynamic Port.
-In SQL Server Management studio add the port name to your connection string as follows:
if you were connecting to:
MYSERVER\SQLEXPRESS
the port is specified as
MYSERVER,2071\SQLEXPRESS