Cannot connect to SQL Server 2008R2 Express - sql

I have just installed SQL Server 2008 R2 Express. I haven't set anything unusual during the installation process. Everything was default, that the instance name is SQLExpress, the connection is via SQL Server with user sa and my password. I have opened SQL Server Configuration Manager and I can see under SQL Express Service, SQL Server (SQLEXPRESS)'s state is running. Yet, it does not let me get connected :/
I am using Commodo Internet Security. I have looked at Firewall Log and it says only that Windows Operating System is blocked. I set CIS to ask for every connection and it doesn't show anything. I am not sure if it's it.
Any idea how to diagnose the problem? Thanks in advance.
EDIT:
Under the Server Name, I provide SQLEXPRESS which was the set name while installing the server.

As server name, you need to use
.\SQLEXPRESS or (local)\SQLEXPRESS
where the dot . stands for the local machine - SQLEXPRESS is the name of the instance (not the server name itself)

Related

Connecting to SQL Server Express - What is my server name?

I was just given a laptop to perform some development from a client and I am currently in the process of setting it up. Visual Studio 2010 is installed as well as SQL Server Management Studio 2008 R2. I'm trying to open SQL Server Management Studio to connect to the database but so far am not having much luck. I'm used typing in for a server name something like...
localhost
(local)
SQLEXPRESS
None of these are working.
So my question is: How can I tell what type of SQL Server installation and configuration I have on this machine, and how can I discover what server name I need to use in order to properly connect to it?
--Addition--------------------------------------------
I looked into the services as directed and found a few instances as indicated. SQLEXPRESS and MSSQLSERVER. I have tried to login with both of those options in these configurations...
SQLEXPRESS
MSSQLSERVER
computername\SQLEXPRESS
computername\MSSQLSERVER
.\SQLEXPRESS
.\MSSQLSERVER
None of these worked. I also altered the 'Log On As' property of the services from 'Network Service' to 'Local System' and tried them again. Still no success.
Instead of giving:
./SQLEXPRESS //in the Server Name
I put this:
.\SQLEXPRESS //which solved my problem
You should be able to see it in the Services panel. Look for a servicename like Sql Server (MSSQLSERVER). The name in the parentheses is your instance name.
If sql server is installed on your machine, you should check
Programs -> Microsoft SQL Server 20XX -> Configuration Tools -> SQL Server Configuration Manager -> SQL Server Services
You'll see "SQL Server (MSSQLSERVER)"
Programs -> Microsoft SQL Server 20XX -> Configuration Tools -> SQL Server Configuration Manager -> SQL Server Network Configuration -> Protocols for MSSQLSERVER -> TCP/IP
Make sure it's using port number 1433
If you want to see if the port is open and listening try this from your command prompt...
telnet 127.0.0.1 1433
And yes, SQL Express installs use localhost\SQLEXPRESS as the instance name by default.
Sometimes none of these would work for me. So I used to create a new web project in VS and select Authorization as "Individual User Accounts". I believe this work with some higher version of .NET Framework or something. But when you do this it will have your connection details. Mostly something like this
(LocalDb)\MSSQLLocalDB
by default -
you can also log in to sql express using server name as:
./SQLEXPRESS
or log in to sql server simply as
.
This was provided after installation of Sql Express 2019
Server=localhost\SQLEXPRESS;Database=master;Trusted_Connection=True;
So just use 'localhost\SQLEXPRESS' in server name and windows authentication worked for me.
Similar to what StuartLC was saying, my problem was not resolved until I enabled TCP/IP protocol under SQL Network Configuration>>Protocols for MSSQLSERVER in the SQL Server Configuration Manager dialogue box. After enabling this and a restart, my SSMS connected right away with just the instance name (no ~\MSSQLSERVER).
All of the following services should be running,for successful connectivity:
SQL Full test filter Daemon,
SQL server(SQLEXPRESS),
SQL Server Agent(SQLEXPRESS),
SQL Server Browser,
SQL server reporting service and
SQL Server VSS Writer

Unable to connect to SQL Server 2005 installed on Win7 virtual machine

I am not able to connect to a SQL Server 2005 hosted on a Win7 virtual machine. I am new to VM, can someone help me locate the problem?
I am able to connect another SQL server which is installed on the local machine.
When you say you can't connect - that can mean a lot of things - really you need to be much more specific.
In addition to the comments and answers already here - If you're having trouble connecting to it in Sql Server Management Studio - you should open Configuration Manager on the VM itself and make sure that Shared Memory and Named Pipes are enabled (open the SQL Server Network Configuration node in the tree).
For example, SQL Server Express instances are configured by default to reject the kind of remote connection that SSMS wants to open by default.
first of all check your connection string (for reference):
http://www.connectionstrings.com/
Second you need to add an exception in the guest machine firewall or completely disable it (port 1433 is for sql tcp/ip access).
this works fine for me:
SQLConn.ConnectionString = "Network Library=DBMSSOCN; Data Source=xxx.xxx.xxx.xxx,1433;
Initial Catalog=mySQLServerDBName; User ID=myUsername;Password=myPassword"
good luck

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

SQL Server 2008 R2 First Time Login

I've just started work on a new computer in which I had to download all the software fresh.
I've just download a copy of SQL Server 2008 R2, and I'm trying to connect to SQL Server Management Studio without success. I vaguely remember last time I installed this, it asked me to choose between windows, or sql server authentication, however this didn't happen for this installation.
If I try to login via Windows Authentication (where the username and password fields are greyed out, localhost as server name) it gives the following error:
"A Network-related or instance
specific error occured 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 have checked everything in SQL Server Configuration Manager, and everything bar VIA is enabled.
If I try SQL Server Authentication, It asks me for a username and password which I definiately have not set yet. Also, under SQL Server Services in configuration manager, there is nothing there.
Any help would be appreciated :)
Thanks
PS: I don't know if it's worth mentioning but I am running Windows 7 as a virtual machine on a Mac.
Are you sure you have the correct instance name? If it was SQL Server 2008 R2 Express Edition then the default instance name is .\SQLEXPRESS.
Also if your using sql authentication to connect try running sql management studio as admin, if you are a limited user your identity might not be mapped to an account in sql server yet but i believe the Administrators user group is.
You need to check if your services are running.
Please type
net start mssqlserver
in your command prompt. Then try to login.
Ended up reinstalling completely and doing a fresh install from a fresh download. When I did this I was brought through the steps of selecting the default instance, and selecting authentication modes.
Working fine now :)
After checking tons of sites looking for an answer to this question, I think I have a simple solution.
Open the sql Server Configuration
Click on the sql server services node
Right Click on Sql server
Click Start.
I have been screwing around with this forever, and this simple method actually worked.

SQL SERVER 2005 Connectivity Problems

I am having a hell of a time trying to connect to the SQL SERVER 2005 database. I am using Windows 7.
Here is the screenshot of the error thrown:
(source: highoncoding.com)
I have been battling this issue for the past week and still no progress.
I have tried the following in the server name:
(local)
localhost
computername
none of them worked!
I just checked in the services section and SQLSERVER EXPRESS is not even there. I am using the following post as a reference:
https://serverfault.com/questions/11745/i-cannot-connect-to-my-local-sql-server-2008
This instance of SQL Server is running on the same PC you're connecting from? That's the implication of 'local'.
Possibilities :
1) Try (local) instead of local for the server name
2) Try 'MSSQLSERVER' as the name
3) Check the SQL Server Configuration Manager shows the same configuration options you're attempting to connect with, eg the same instance name, Named Pipes enabled, services running ok, etc.
EDIT :
Ok, what are you using to connect with? SQL Server Management Studio Express? Are you sure you installed an instance? The lack of SQLExpress in the services list would seem to indicate otherwise.
When you connect to a SQL Server you specify the name in the form {computername}\{instancename}. The {instancename} is the name of the SQL instance which was chosen during the SQL Server installation. For {computername} you can substitute the special names . or local when connecting to the localhost machine. If the SQL Server was installed as the Default instance then the instance name part must be omitted, so the connection Server name becomes just the computer name.
SQL Server Express installs by default an instance named SQLEXPRESS. The corresponding NT service name is MSSQL$SQLEXPRESS. The Server name in the connection dialog is .\SQLEXPRESS, local\SQLEXPRESS, localhost\SQLEXPRESS or {computername}\SQLEXPRESS (they're all the same).
If the SQL Server was installed as the Default instance name then the corresponding NT service name is MSSQLSERVER. The Server name in the connection dialog is ., local, localhost or {computername} (they're all the same).
If the SQL Server was installed as a named instance then the corresponding NT service name is MSSQL${INSTANCENAME}. The Server name in the connection dialog is .\{INSTANCENAME}, local\{INSTANCENAME}, localhost\{INSTANCENAME} or {computername}\{INSTANCENAME} (they're all the same).
When connecting from a remote computer to a SQL Server instance the SQL has to be configured to allow remote connection How to configure SQL Server 2005 to allow remote connections.
Check your SQL server configuration, make sure the TCP connections are enabled. You can also check that the SQL Browser service is started. Make sure you do not have a firewall that gets on the way. Make sure the SQL Server service is also started.
Did you install SQL Server on the default instance, or have you used named instances? If you've used named instances then the server will be server\instancename. If you don't know, then have a look in the Services administrative tool; you'll be able to determine the instance name, if any, from there).
You could also try connecting with the server name as a single period (i.e. simply ".") [caveat... I've not got access to SQL Server at the moment, but I think I've used this before now].