How to Connect to My Local Network SQL Server - sql-server

My desktop machine has SQL Server installed. I can connect to it (using my desktop machine) using the following server name:
localhost\SQL_Express
Windows Authentication
If I want to connect to it using my Laptop, I try to do the following (ACER_ASPIRE is my computer name):
ACER_ASPIRE\SQL_Express
SQL Authentication (acerAspireUserName, acerAspirePassword)
I get an error saying the server wasn't found. How can I go about connecting to my desktop machine's SQL Server from my Laptop?

To connect to a Sql Server you need to specify two things.
1 - Server name
In this section you are suppose to provide [ServerName\InstanceName]
Server Name is the Machine Name where your sql server Instance lives. And obviously since sql server can have multiple instances on one machine you need to provide the instance name that you want to connect to.
There is an exception for Instance name if you are connecting to the Default Instance you dont need to provide full [ServerName\InstanceName] you can only use the machine name to connect to the default instance on sql server on that machine.
One thing you need to know is
localhost == . == MachineName == ServerName
These are all different ways you can tell sql server , the server name that you want to connect to.
2 - Authentication
You have two ways to authenticate yourself when connecting to sql server,
Windows Authentication.
Sql Server Authentication.
In 1st section ServerName you told sql server that which machine and what instance you want to connect to.
Now in this Authentication Section you will have to tell sql server how you will be Authenticated.
When using Windows Authentication Sql server will use your windows credentials to identify you. This has nothing to do with the Server/Machine name it is to do with the Operation system of the machine, in your case it is windows and you can use your windows credentials.
On the other hand if you use Sql Server Authentication you will have to use a Sql Server Login' andPassword`. In this case sql server will not care what operating system you have on your machine. (mostly used when you are working on operation systems other than windows like Linux, Unix, Mac). It will only take consideration the login and password you pass.
Authentication Mode
What Authentication Mode you can use? this depends on your sql server configuration when you were installing, You can set your sql server to Only Allow Windows Authentication or Mixed Mode (i.e Windows Authentication and Sql Server Authentication).
Your Case
In your Case regardless of what Authentication Mode you are using. You can use any notations in sql server SERVER Section as long as they point to your machine like
local, localhost, . , ACER_ASPIRE
But for Authentication if you are using Sql Server Authentication Make sure you are using a Valid Sql Server Login and Password.

Open the query window, and inside it execute the following:
EXEC sys.sp_configure N'remote access', N'1'
GO
RECONFIGURE WITH OVERRIDE
GO
This option is not enabled by defauld on Express edition.

By default, SQL Express doesn't support LAN Connections, only from local machine.
To use it you must configure to listen to network ports also. You can do that on the SQL Server Surface configuration tool.

Related

Default SQL Authentication Details for SQL EXPRESS 2016

I'm attempting to remotely connect to my SQL Express 2016 server through MS SQL on my local machine however am having extreme difficulties with the authentication.. Well I assume it is an authentication issue as when I attempt connect to connect to it I receive the error message:
The remote computer refused the network connection.
When connecting through the sqlcmd I am using Windows authentication and have no issue, however to connect to it remotely I need to use SQL authentication and have no memory of creating an account so am wondering if there's a default login and password?
I believe this is the issue however it is quite likely i'm doing something stupid so any assistance would be appreciated!
You can create an account that can be used to connect to that SQLExpress instance by using SQL Server Management Studio. Expand the database you wish to create a login for in the Object Explorer. Under the Security folder, you can create a new login by right clicking the Logins folder.
Also make sure that your machine has its firewall configured to allow remote connections, the server has remote connections enabled, and that you are allowing logins for Windows Auth and SQL Server Auth.
You can allow remote connections for a server by opening the SQL Server Configuration Manager. Under the SQL Server Network Confiuration Node, Select Protocols for MYSERVERNAME. Ensure that TCP/IP is enabled.
Here's a guide on setting up the firewall: https://technet.microsoft.com/en-us/library/ms175043(v=sql.110).aspx
You can enable SQL Server Authentication by right clicking your server name in the object explorer in SQL Server Management Studio and going to the Security tab. look for the "Server Authentication" option.

How To Connect A Azure Sql Server 2012 Database From Localmachine

I want to connect my SQL server management studio which is running locally with a Azure SQL Server 2012 database
Now i have enable the sa account on the SQL server side and i also check the server name by running this query --
SELECT ##SERVERNAME
I got the output
MSRV01\SQLSERVER
Now from my local machine when i am trying to loginto that Azure SQL server like this --
It retun this error
Do any one have any idea what i am doing wrong here !
Unless your local machine is on the same domain (or even subnet) as the azure VM then accessing via machine hostname will never work.
If you are using an Azure hosted database (i.e. not a VM) then in your Management Portal, navigate to the database settings panel. At the top will be listed the Server name with a URL like xxxxxxxx.database.windows.net. Use this to connect to your database in SSMS.
Further reading: https://azure.microsoft.com/en-gb/documentation/articles/sql-database-connect-query-ssms/

SQL Server 2014 Express on Windows 10

I've downloaded and installed SQL Server 2014 Express on Windows 10, I've been through this loop at least 3 times now. The installation completes without warnings or errors. I have chosen to use Window authentication. I'm trying to use HeidiSQL to connect to SQL Server. I already have MariaDB installation and am able to connect to that using HeidiSQL.
When I connect to MariaDB I am able to select Databases from the drop down combo, but not for SQL Server. I don't seem to be able to connect with HeidiSQL.
In HeidiSQL, the settings are:
Network type: Microsoft SQL Server (TCP/IP, experimental)
Hostname / IP: 127.0.0.1
Ticked checkbox 'Use Windows authentication'
Port: 1433
I can't select a Database, if I click on the Open button after a while it comes up with:
SQL Error(17): [DBNETLIB]ConnectionOpen (COnnect()).]SQL does not exist or access denied SQL Server does not exist or access denied.
In order to use HeidiSQL's network type Microsoft SQL Server (TCP/IP), you need to activate TCP/IP protocol in your MSSQL configuration.
Further on, I am unsure if Windows authentication worked for me, as I'm always using the default SA user, which is created while installing SQL Server.
Apart from that, you should be able to connect using <yourmachine>\SQLEXPRESS on port 1433.
Use Microsoft SQL Server (named pipe) as Network type and .\SQLEXPRESS for Hostname / IP
SQL Server Express by default installs as a named instance called SQLEXPRESS - so for your "hostname", try one of these:
.\SQLEXPRESS
(local)\SQLEXPRESS
yourmachine\SQLEXPRESS
your-ip-address\SQLEXPRESS
Those should work.

Remote connection to SQL server 2008 sp2

I built a window application in visual studio 2010. It is working fine at my computer.
if i have a pc that works with windows server 2008 and i install a sql server on it , how to make my application connect to database in the sql server that instaled in the server pc .
my pc connected to the server domain .
thanks
Assuming your application is already configured to use a Sql connection string, you'll just need to configure it for the Sql Server instance you're connecting to.
For example, if your database is called MyDatabase, and your windows server on your domain is called myserver.local, and you've installed Sql Express with the default SQLEXPRESS instance name, you could create your connection string (assuming ADO.NET) something like this:
Integrated Security=true;Initial Catalog=MyDatabase;Data Source=myserver.local\SQLEXPRESS
This configuration would be for Windows Authentication (Integrated Security=true): so your domain user accounts would need to be granted LOGIN rights on the server, and those Logins associated with USERS and ROLES in your database. If you wanted to use Sql Logins instead (generally requires extra configuration when setting up your Sql Server), there are different connection strings settings for specifying username and passwords. There are many options available for the connection strings as documented here: https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.connectionstring(v=vs.110).aspx. However, with Windows Authentication the only 3 you absolutely need are the ones shown above.
You can test connectivity to your Sql Server from your PC on the network using Sql Server Management Studio, which will enable you to verify the instance name and the authentication is working as expected if you can connect to the database.

sql server 2008: configuration information

I have sql server 2008 installed on my dev machine. How I figure out things like, the name of the server, do I connect to it using windows auth or using sql auth. If I connect using sql auth what is my account information. I set it up a while back and I dont know how to read all the sql server install and configuration information. I am trying to install Vault and its trying to connect to sql server and I dont know things like sql server name, login credentials on my machine.
Your local machine can be specified as (local) or localhost or even just . (a period) as the SQL Server (machine) name.
If you can connect to SQL Server using Windows auth - that's probably the easiest way to go. So just try if that works, and if it does - perfect!
Otherwise, you need to find out what your sa (system administrator) account on your local server uses as a password - that's your key to everything, basically. If you don't know that password anymore.... you might need to reinstall SQL Server to get that password back.

Resources