Friday 28 April 2017

How do you configure SQL Server to allow a database connection locally or from a remote machine?

How do you configure SQL Server to allow a database connection locally or from a remote machine? I have a simple test with user=sa and password=123456. I can login to the server instance using SQL Management Studio with SQL Server and Windows Authentication mode enabled. I tried to login from another computer (Linux) using mssql module from npm to connect and I get a message: 'Login failed for user \'sa\'.', code: 'ELOGIN'.

That was after opening up port 1433 in windows firewall (Windows 10). Here is my config and i get the same results from remote machine if i use computer name for server or IP address for server. Note I'm using the demo database that can be downloaded for SQL Server 2016.

const config = {
    user: 'sa',
    password: '123456',
    // server: '192.168.12.14',
    server: 'DESKTOP-AAFERR',
    // port: '1433',
    database: 'AdventureWorks2016CTP3',
    pool: {
        max: 10,
        min: 0,
        idleTimeoutMillis: 30000
    }
}

What i tried to do was open SQL Server Configuration Manager and enable TCP/IP for the server instance. However when I did that, I was not able to login locally from SQL Server Management Studio anymore using SQL Server authentication. I would get message Login failed (Microsoft SQL Server, Error: 18456). But I also still could not login remotely. So i disabled TCP/IP again so i could login locally.

How do you configure SQL Server to allow a database connection locally or from a remote machine? I opened port 1433 in the firewall. What else do I need to configure in SQL Server Management Studio or SQL Server Configuration Manager?



via jtlindsey

No comments:

Post a Comment