Published: 2026-11-18

Can’t Connect to SQL Server from a Mac: Causes and Fixes

This is for a Mac user whose SQL Server connection fails, whether the server runs in Docker on the Mac or on another machine. Find the message you see in the table below and jump to its section: each one has the exact text, why it happens on a Mac, the fix and how to check it. The sections are ordered by how often each failure shows up in Jam SQL Studio’s anonymous usage data: in the 30 days to November 10, 2026, 165 of the 256 Macs that tried to connect to SQL Server from the app had at least one failed test or connect, and Login failed was the most common cause. We reproduced the messages on November 10, 2026 with the Node.js driver the app uses on macOS, and with the app itself, on Linux against SQL Server 2025 in Docker; the two we could not produce there (Azure SQL’s firewall and a Windows SQL Server Browser) are quoted from Microsoft and the driver, and the parts that only exist on a Mac are sourced from Apple, Docker and Microsoft and marked as not tested here.

For the general version of these errors, including the 18456 state table, pre-login handshake failures and pool exhaustion, see SQL Server connection errors and how to fix each one. This post covers what is different when the client is a Mac.

Find your error

The message containsLikely cause on a MacSection
Login failed for user 'sa'.The container got a different password from the one you typed, it was still starting, or the password is wrongLogin failed
Login failed for user ''.Windows Authentication chosen on a MacWindows Authentication
Failed to connect to …:1433 in 30000msNothing answered: VPN off, a firewall dropping port 1433, a wrong addressTimeout
connect ECONNREFUSED 127.0.0.1:1433Nothing listening on that port: the container is stopped or exited, or uses another portConnection refused
getaddrinfo ENOTFOUND …The name resolves only on the office network or VPN, or is a short Windows computer nameHost name not found
self signed certificate or self-signed certificateTrust server certificate is off for a server with its own self-signed certificateSelf-signed certificate
Connection lost - socket hang up, read ECONNRESETThe container is still starting, keeps restarting, or its port leads nowhereSocket hang up
Client with IP address '…' is not allowed to access the serverAzure SQL has no firewall rule for the network your Mac is on nowAzure SQL firewall
Failed to connect to localhost\SQLEXPRESS in 30000ms, Port for … not found in …A named instance with no port; containers have no named instancesNamed instance
connect EHOSTUNREACH 192.168.…No machine at that local address, or macOS Local Network access is off for the appHost unreachable

How often each one happens

The order of this post comes from Jam SQL Studio’s anonymous usage events: the desktop app reports that a connection test or connect failed and the cause it recognised, never the server name, the login, the password or the error text. The counts are devices, for SQL Server connections in the 30 days to November 10, 2026. They describe Jam SQL Studio users, not every Mac user.

  • 256 Macs, 88 Windows PCs and 35 Linux machines tried to connect to SQL Server.
  • 165 of the 256 Macs (64%) had at least one failed test or connect, against 42 of 88 Windows PCs (48%) and 20 of 35 Linux machines.
  • 133 of those 165 Macs (81%) connected to SQL Server later in the window, 96 of them (58%) within 10 minutes of the first failure. On Windows 33 of 42 did (79%), 25 within 10 minutes.
Cause, as the app classifies itMacsConnected within 10 minConnected later in the 30 days
Login failed (driver ELOGIN, SQL Server 18456)513341
Timeout (ETIMEOUT)291122
Connection refused (ECONNREFUSED)20715
Host name not found (ENOTFOUND)201017
Certificate not trusted (self-signed)1057
Connection reset (ECONNRESET)929
Azure SQL firewall rule missing655
Named instance not found (EINSTLOOKUP)533
Host unreachable (EHOSTUNREACH)555
Not classified1068

105 Macs hit at least one cause the app recognised, and one Mac can appear in several rows. “Connected later” includes the ones that connected within 10 minutes. Two things stand out. Login failures are the most common and among the quickest to recover from: 33 of 51 Macs connected within 10 minutes, presumably once the password or login was right. Timeouts and refused connections are where people get stuck: 11 of 29 and 7 of 20 connected within 10 minutes. Our reading is that the fix for those is rarely in the connection settings: it is a VPN, a firewall, a container that has to be started or recreated, or a server someone else runs. On Windows, of 35 PCs with a recognised cause, 17 had login failures, 9 an untrusted certificate, 6 a timeout, 4 an unknown host name and 3 a refused connection. These are small numbers and we can’t say why the mix differs; one reading the data can’t confirm is that on a Mac the server is more often a container you start and stop yourself.

1. “Login failed for user ‘sa’”

Login failed for user 'sa'.

SQL Server was reached and refused the login. The message the client gets is deliberately vague: Microsoft’s error 18456 page says that “the error message that is returned to the client deliberately hides the nature of the authentication error”, and that the server’s error log holds the state that says why. With SQL Server in Docker on a Mac, these are the causes we could reproduce:

  • The container got a different password. In double quotes the shell replaces $ and the name after it with a variable’s value. The zsh manual: “Inside double quotes (""), parameter and command substitution occur”. zsh is the Mac’s default shell since macOS 10.15 (Apple), and Microsoft’s Docker quickstart puts the password in double quotes. We ran this in bash, which treats $ in double quotes the same way; set -x shows what Docker actually received:
    $ docker run -d --name sql1 -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=Passw0rd2026$Jam" \
        -p 127.0.0.1:1433:1433 mcr.microsoft.com/mssql/server:2025-latest
    ++ docker run -d --name sql1 -e ACCEPT_EULA=Y -e MSSQL_SA_PASSWORD=Passw0rd2026 -p 127.0.0.1:1433:1433 mcr.microsoft.com/mssql/server:2025-latest
    $Jam was an empty variable, so the sa password became Passw0rd2026, which still met the password policy, and the container started normally. Logging in with Passw0rd2026$Jam failed.
  • The container was still setting up. We connected every 250 ms from the moment we ran docker run. After the SQL Server is now ready for client connections line appeared in the log, the sa login still failed with the correct password for 1.2 seconds (the error log gave State 7, An error occurred while evaluating the password.), then worked. That was on an x86-64 Linux machine; on an Apple-silicon Mac the image runs under Rosetta and we did not time it there.
  • The container reuses an old data volume. Microsoft’s container troubleshooting page: “If you used docker run with an existing mapped data volume… SQL Server ignores the value of MSSQL_SA_PASSWORD.” The sa password is then the one already stored in that volume. We did not test this one.
  • sa is disabled. This one names itself: Login failed for user 'sa'. Reason: The account is disabled. (error 18470).
  • The Database field names a database that isn’t there. The server sends two messages, Cannot open database "B1NoSuchDb" requested by the login. The login failed. and then Login failed for user 'sa'. A driver that shows only the last one makes it look like a password problem.

Jam SQL Studio shows all of these as Login rejected (Cannot open database for the missing database) and puts the server’s whole answer under Error details, so the disabled-account reason and the 4060 message are there.

For a server at work, the usual causes are a wrong password, a login that doesn’t exist, or a server set to Windows Authentication only; Microsoft lists the last as state 58, “When SQL Server is set to use Windows Authentication only, and a client attempts to log in using SQL authentication.” We could not switch a Linux container to that mode, so we did not reproduce it. The full state table is in the general connection-errors post.

Fix

  1. Read the reason in the container’s error log:
    $ docker exec sql1 grep -A1 "Error: 18456" /var/opt/mssql/log/errorlog
    2026-11-10 23:03:01.52 Logon       Error: 18456, Severity: 14, State: 8.
    2026-11-10 23:03:01.52 Logon       Login failed for user 'sa'. Reason: Password did not match that for the login provided. [CLIENT: 172.17.0.1]
    State 8 is a wrong password. During setup we saw State 7 with Reason: An error occurred while evaluating the password. instead.
  2. See which password the container was created with:
    $ docker inspect sql1 --format '{{range .Config.Env}}{{println .}}{{end}}' | grep SA_PASSWORD
    MSSQL_SA_PASSWORD=Passw0rd2026
    This is the value given to docker run. It does not follow later password changes, and with a reused data volume it is ignored.
  3. Log in with that password and set the one you meant. This keeps the container and its databases:
    ALTER LOGIN sa WITH PASSWORD = N'Passw0rd2026$Jam';
    Or remove the container and create it again with the password in single quotes, -e 'MSSQL_SA_PASSWORD=Passw0rd2026$Jam'; the zsh manual says “All characters enclosed between a pair of single quotes ('') that is not preceded by a ‘$’ are quoted.” Databases stored inside a removed container are gone with it.
  4. If you just started the container, wait for SQL Server is now ready for client connections in docker logs sql1 and try again a few seconds later.
  5. If the error mentions Cannot open database, clear the Database field so the login lands in master, or create the database first.
  6. If sa is disabled, log in with another sysadmin login and run ALTER LOGIN sa ENABLE;.

Check: after the ALTER LOGIN above, SELECT SUSER_SNAME() AS login_name, DB_NAME() AS database_name; returned sa and master, and the new password still worked after docker restart sql1.

“Login failed for user ‘’”: Windows Authentication from a Mac

Login failed for user ''.

An empty user name means the client sent no login at all. In Jam SQL Studio that happens when Windows authentication is chosen on a Mac: the app supports Windows Authentication only on Windows, but in version 1.5.10 the Authentication list still offers it on macOS, and the attempt reaches SQL Server with no user name (we ran that code path, which is the same on macOS and Linux, on Linux). When you import saved connections from another tool, version 1.5.10 marks the ones that use Windows Authentication with “Windows authentication is not available on macOS. After importing, switch this connection to SQL login or Microsoft Entra ID before connecting.” In the usage data, 2 Macs imported such connections, a small number. Version 1.5.11 and later do not offer the option on macOS or Linux: there the app connects with a Node.js driver that cannot sign in as a Windows user, so it could only fail. A connection that already has the setting is not sent to the server. The app shows “Windows authentication works only on Windows. Choose SQL Server authentication or Microsoft Entra ID.” on the import row, in the connection form and when you connect, and it does not test or connect until one of the two is chosen.

The options from a Mac:

  • A SQL Server login. Ask the server’s administrator for one (CREATE LOGIN … WITH PASSWORD). The server has to allow SQL Server authentication, or the login fails with state 58 as described above.
  • Microsoft Entra ID, for Azure SQL Database, Azure SQL Managed Instance and SQL Server set up for Entra authentication. Jam SQL Studio signs in with Microsoft Entra ID (Interactive Browser) or (Device Code) on macOS.
  • Kerberos, with other tools. Jam SQL Studio does not support Kerberos. Microsoft says its ODBC driver “on Linux and macOS supports connections that use Kerberos integrated authentication”, with Trusted_Connection=yes, a krb5.conf for your domain and a ticket from kinit, and that “If Kerberos authentication fails, the ODBC driver on Linux or macOS does not use NTLM authentication.” We did not test it.

For SQL Server on Linux, and so in a container on your Mac, Windows logins need the server joined to an Active Directory domain, with a service principal name and a keytab; Microsoft’s Active Directory tutorial for SQL Server on Linux walks through it. For a container you use for development, sa or another SQL login is the practical choice.

2. “Failed to connect to … in 30000ms”: the connection timed out

Failed to connect to <address>:1433 in 30000ms

The driver waited 30 seconds and nothing answered at all. We got this against an address whose firewall silently drops port 1433 (the address is replaced here). Unlike a refused connection, a timeout doesn’t say whether the server exists; the packets just vanished. On a Mac laptop the usual reasons:

  • The server is on the office network and the VPN is off, or you are on a different network than yesterday.
  • A firewall between you and the server drops port 1433: the server’s own, the office’s, or a guest network’s. For Azure SQL, Microsoft says to “ensure that the firewall on your network and local computer allows outgoing communication on TCP port 1433” (Azure SQL firewall rules).
  • The address is wrong, or the virtual machine behind it is stopped.
  • A named instance such as localhost\SQLEXPRESS without a port: this also ends in a 30-second timeout, see Named instance.

Fix

  1. Test the port from Terminal before changing any SQL setting. These are the three answers we got from nc on Linux (OpenBSD netcat); macOS has its own nc, whose wording we did not check:
    $ nc -vz -w 5 <address> 1433
    nc: connect to <address> port 1433 (tcp) timed out: Operation now in progress
    
    $ nc -vz -w 5 localhost 14999
    nc: connect to localhost (127.0.0.1) port 14999 (tcp) failed: Connection refused
    
    $ nc -vz -w 5 localhost 1434
    Connection to localhost (127.0.0.1) 1434 port [tcp/*] succeeded!
    Timed out is the network; refused means the machine answered but nothing listens on that port (next section).
  2. Connect the VPN, or join the network the server is on, and test again.
  3. If the server works from the office but not from home, its firewall probably allows only office addresses. That is for whoever runs the server to change.
  4. For a named instance, enter its port (see Named instance).
  5. Don’t raise the connect timeout first: if nothing answers in 30 seconds, nothing answers in 60.

Check: nc reports succeeded, then the connection test connects. If nc succeeds and the app still can’t connect to an address on your local network, read Host unreachable: macOS lets Terminal through where it may block an app.

3. “connect ECONNREFUSED 127.0.0.1:1433”: connection refused

Failed to connect to localhost:1433 - Could not connect (sequence)
connect ECONNREFUSED 127.0.0.1:1433

The first line is the driver’s message; the second is the cause underneath it. A refusal comes back at once (6 ms in our test): the machine answered and said nothing listens on that port. When the address is localhost, the machine is your Mac, so for SQL Server in Docker it means:

  • The container is stopped. Quitting Docker Desktop or restarting the Mac stops it. Docker Desktop’s settings list Start Docker Desktop when you sign in to your computer as off by default, and a container’s restart policy is no unless you set one (Docker).
  • The container exited during setup. Microsoft’s quickstart: “If you don’t follow these password requirements, the container can’t set up SQL Server, and stops working.” The requirement is “at least eight characters long and contain characters from three of the following four sets: uppercase letters, lowercase letters, base-10 digits, and symbols.” With MSSQL_SA_PASSWORD=sqlpass our container stopped 9 seconds after it started, and connecting gave exactly the refusal above.
  • The container publishes another port. With -p 127.0.0.1:14333:1433 the Mac side is 14333, and that is the number for the Port field.

For a server on another machine, a refusal means it is reachable but SQL Server isn’t listening on that port: the service is stopped, it uses another port, or TCP/IP is turned off in SQL Server Configuration Manager. The general post covers that side.

Fix

  1. Look at the container’s status, including stopped ones:
    $ docker ps -a --filter name=sql1 --format 'table {{.Names}}\t{{.Status}}'
    NAMES     STATUS
    sql1      Exited (255) Less than a second ago
    That one had exited by itself 9 seconds after docker run. A container stopped with docker stop showed Exited (137) in our run.
  2. If it exited by itself, read why. For the short password:
    $ docker logs sql1 2>&1 | grep -A1 "ERROR"
    2026-11-10 23:09:46.21 spid55s     ERROR: Unable to set system administrator password: Password validation failed. The password does not meet SQL Server password policy requirements because it is too short. The password must be at least 8 characters..
    2026-11-10 23:09:46.21 spid55s     An error occurred during server setup. See previous errors for more information.
    Remove that container and create it again with a password that meets the policy, in single quotes. Its databases were never set up, so nothing is lost.
  3. If it was simply stopped, start it: docker start sql1. Give it a few seconds; see Socket hang up for what you get while it starts.
  4. Check which port the Mac side uses:
    $ docker port sql1
    1433/tcp -> 127.0.0.1:1433
    The number after the last colon goes in the Port field.
  5. To have the container come back after a restart, turn on Start Docker Desktop when you sign in to your computer and create the container with --restart unless-stopped, which Docker documents as not restarting a container you stopped yourself. We did not test this on a Mac.

Check: docker ps shows Up for the container and nc -vz localhost 1433 succeeds.

4. “getaddrinfo ENOTFOUND”: host name not found

Failed to connect to sqlserver01.corp.invalid:1433 - getaddrinfo ENOTFOUND sqlserver01.corp.invalid

The Mac could not turn the server name into an address, so no packet was sent. Reasons this happens on a Mac:

  • The name exists only in the company’s DNS, which your Mac uses only on the office network or with the VPN connected.
  • The server is given by a short computer name, such as SQLBOX01, that colleagues on Windows PCs use. A short name can depend on a DNS search domain or Windows name resolution that your Mac doesn’t have; try the full DNS name, such as sqlbox01.corp.example.com, or the IP address.
  • host.docker.internal is a name for containers: Docker’s networking guide says it “Resolves to the internal IP address of your host”, for a container that wants to reach the Mac. From the Mac to a container, use localhost.
  • A typo in the server name.

Fix

  1. Connect the VPN if the server is a company one, and try again.
  2. Use the full DNS name, or the IP address. With an IP address and Trust server certificate off, a server certificate issued for the name won’t match the address.
  3. Test the name from Terminal; on Linux nc printed nc: getaddrinfo for host "sqlserver01.corp.invalid" port 1433: Name or service not known.

Check: nc -vz <name> 1433 no longer reports a name error.

5. “self signed certificate”: the server certificate isn’t trusted

Failed to connect to localhost:1434 - self signed certificate

That is the driver text as Jam SQL Studio shows it under Error details; the same driver run under Node.js 22 spells it self-signed certificate. Our test server listened on port 1434. The connection was encrypted, and the driver refused the certificate because no authority your Mac trusts signed it. Microsoft: “If a trusted certificate isn’t installed, SQL Server generates a self-signed certificate (fallback certificate) during startup” (Configure SQL Server encryption, written for Windows; the Linux container did the same). The SQL Server container presents one too. A new SQL Server connection in Jam SQL Studio starts with Encrypt connection and Trust server certificate both on, so the error shows up for connections with trust turned off: imported from another tool, pasted from a connection string without TrustServerCertificate=True, or unticked by hand.

Fix

  1. For a container on your Mac or a development server: tick Trust server certificate, or click Retry trusting the server certificate (less secure) under the Server certificate not trusted error; in our run the retry connected and left the box ticked. The connection stays encrypted; the certificate is not checked. Microsoft: “Trusting the server certificate causes the client to skip the step that validates the server certificate and continue with the encryption process” (Microsoft Learn). In other tools it is TrustServerCertificate=True in the connection string, or -C for sqlcmd.
  2. For a server on a network you don’t control: have a certificate from a trusted authority installed on the server. The same page says “You shouldn’t rely on TLS/SSL using self-signed certificates in a production environment or on servers connected to the Internet.”

Check: with trust on, the test connects. In the usage data the one-click retry was used on 4 Macs and connected on 3, a small number.

6. “Connection lost - socket hang up”: the connection was reset

Connection lost - socket hang up
Connection lost - read ECONNRESET

Something accepted the connection and closed it before SQL Server answered. We got both lines from a container that was starting: after docker restart sql1 they alternated for 1.9 seconds, and the login worked at 3.2 seconds. A fresh docker run gave socket hang up first, then the setup login failures from section 1. We also got socket hang up, at once and every time, from a published port with nothing behind it in the container (-p 127.0.0.1:14574:1433 on a container whose server wasn’t on port 1433). Both runs were on Linux, where Docker’s proxy accepts the connection for the container; we did not test what Docker Desktop for Mac does in the same cases.

Jam SQL Studio has no specific message for this one: it shows Connection failed, “Jam SQL Studio could not connect. Check the connection settings and try again.”, with Connection lost - socket hang up under Error details. 9 Macs hit it; only 2 connected within 10 minutes, but all 9 connected within the 30 days.

Fix

  1. Wait a few seconds after starting the container and try again. We timed startup on Linux only; under Rosetta on an Apple-silicon Mac it may take longer.
  2. Check that it stays up: docker ps should show Up with a growing time, not Restarting or a container that is gone. One of our containers exited during startup with ASSERT: Expression=(!currentWorker->IsPreemptiveOnEntry()) in docker logs; the same command run again started normally. For SQL Server 2025 containers that crash on an Apple-silicon Mac, see How to Run SQL Server on a Mac, which covers pulling a newer image.
  3. Check the mapping with docker port sql1: the container side must be 1433/tcp.
  4. For a remote server, a reset in the middle of the handshake can come from a VPN or proxy; the general post covers TLS and pre-login resets.

7. “Client with IP address … is not allowed to access the server”: Azure SQL firewall

Cannot open server '{0}' requested by the login. Client with IP address '{1}' is not allowed to access the server.

This is the text Microsoft documents for error 40615 (Microsoft Learn), with the server name and your address in place of {0} and {1}; we have no Azure SQL server in the lab and did not reproduce it. Azure SQL lets in only the addresses in its firewall rules, and a Mac laptop changes its public address with every network: home, office, a café, a phone hotspot, a VPN. Jam SQL Studio shows this as Firewall blocked, “The Azure SQL firewall blocked this client IP.”, with the server’s message under Error details; we checked that against the app’s code with Microsoft’s text.

Fix

  1. In the Azure portal, open the server, “select Networking from the Settings menu… Add a rule in the Firewall rules section to add the IP address of the computer that you’re using, and then select Save” (Microsoft Learn).
  2. Wait: “There might be up to a five-minute delay for changes to the Azure SQL Database firewall configuration to take effect.”
  3. If you can’t change the rules, ask whoever can; a rule for a VPN’s fixed exit address saves adding one per network.

5 of the 6 Macs that hit this connected within 10 minutes.

8. “localhost\SQLEXPRESS” times out: named instances

Failed to connect to localhost\SQLEXPRESS in 30000ms

A server name like localhost\SQLEXPRESS, copied from a Windows setup, asks the SQL Server Browser service on UDP port 1434 which TCP port the instance uses. Microsoft’s Browser page: “SQL Server Browser responds with the TCP/IP port or named pipe of the requested instance.” SQL Server on Linux, and so every container, has neither: “The SQL Server Browser service isn’t required on Linux because only a single default instance is supported per host” (SQL Server 2025 on Linux). With nothing answering on UDP 1434, the driver waited the full 30 seconds, both for localhost and for a remote address. When a Browser does answer but doesn’t know the instance, for example a misspelled name on a Windows server, the driver’s message is Port for <instance> not found in <server>; that text is from the driver’s source, as there is no SQL Server Browser on Linux to reproduce it with. Jam SQL Studio shows the first case as Connection timed out and the second as a plain Connection failed, with the driver’s text under Error details.

Fix

  1. For a container on your Mac: server localhost, the published port (usually 1433), no instance name.
  2. For a named instance on a Windows server: ask for its TCP port and enter it in the Port field. Microsoft: “If the SQL Server Browser service isn’t running, you can still connect to the SQL Server if you provide the correct port number or named pipe.”
  3. Or have UDP 1434 opened between you and the server and SQL Server Browser started, which is a change on the server side.

9. “connect EHOSTUNREACH”: host unreachable, and macOS Local Network access

Failed to connect to 192.168.122.250:1433 - Could not connect (sequence)
connect EHOSTUNREACH 192.168.122.250:1433

We got this after 3 seconds for an address on a local network with no machine behind it. On a Mac there is one more cause. Since macOS 15, apps need permission to reach devices on the local network. Apple’s TN3179: “Outgoing traffic to a local network address requires local network access.” A local network is “an IP network associated with a broadcast-capable network interface. Such interfaces include Wi-Fi and Ethernet, but not cellular (WWAN) or VPN.” Command-line tools are exempt: macOS allows “Command-line tools run from Terminal or over SSH, including any child processes they spawn”. So the sign of a missing permission is that nc reaches the server from Terminal and the app does not. Apple does not document which error code an app’s blocked connection gets, so treat this as a likely cause to check, not a diagnosis.

Jam SQL Studio on macOS reads EHOSTUNREACH or ENETUNREACH to a private address (such as 192.168.x.x or 10.x.x.x), and permission errors, as this case and says so in the error: “macOS may be blocking local network connections for this app. Open System Settings → Privacy & Security → Local Network and make sure Jam SQL Studio is enabled.” We checked that wording against the app’s code with a macOS user agent; we could not run the app on a Mac for this post.

Fix

  1. Open System Settings → Privacy & Security → Local Network and switch the app on (Apple Support). The app’s own hint also suggests switching it off and on again if it is already on.
  2. Check the address: is the server on, and on the network your Mac is on now?
  3. For an address reached through a VPN, check that the VPN is connected and routes that network.

All 5 Macs that hit this connected within 10 minutes.

SQL Server in Docker on a Mac: the parts that differ

SQL Server has no macOS build, so a server on the Mac itself runs in Docker, and many of the sections above end in a container. What Docker’s documentation says about Docker Desktop for Mac, which we did not test on a Mac:

  • Connect to localhost and the published port. Docker Desktop makes “whatever is running on port 80 in the container” “available on port 80 of localhost” for a published port (Docker), and the same goes for 1433.
  • Not the container’s own IP address. Under its known limitations for Mac and Windows: “Docker Desktop can’t route traffic to Linux containers”, and “the Docker bridge network is not reachable from the host.” So an address like 172.17.0.2 from docker inspect is not one to connect to from the Mac.
  • host.docker.internal goes the other way, from a container to the Mac.
  • -p 1433:1433 listens on every network interface: “By default, docker run -p listens on all network interfaces (0.0.0.0)” (Docker), and Docker’s port publishing page warns that “Publishing container ports is insecure by default.” -p 127.0.0.1:1433:1433 keeps the port to your Mac.
  • Two containers can’t publish the same port. On Linux the second docker run failed with Bind for 127.0.0.1:14574 failed: port is already allocated; we did not check Docker Desktop’s wording. Give the second one another port, such as -p 127.0.0.1:14333:1433, and enter 14333 in the Port field.
  • Apple silicon. The image is x86-64 only and runs under Rosetta, which Microsoft’s quickstart lists as not tested or supported. Setup and the known crashes are in How to Run SQL Server on a Mac.

Jam SQL Studio’s Detect local databases button in the New Connection dialog lists running database containers and fills in the host port and the sa password from the container’s environment, which is the value Docker received: a password the shell changed is filled in as the container has it. It doesn’t know about a later ALTER LOGIN. In version 1.5.10 it looks for the Docker Engine at DOCKER_HOST or /var/run/docker.sock, and Docker Desktop for Mac creates /var/run/docker.sock only when Allow the default Docker socket to be used is on under Settings → Advanced (Docker; it asks for your password). Detection ran on 20 Macs in the 30 days: 12 found no Docker, 4 found Docker without a database container and 4 found one. With so few, we can’t say how many of the 12 had Docker running without that socket; version 1.5.11 also looks for Docker Desktop’s own socket in your home folder.

What Jam SQL Studio shows for these errors

When a connection test or connect fails, the dialog shows a short title and a sentence for the cause, and keeps the driver’s full message under Error details: Login rejected for a rejected login, Cannot open database when the login can’t open the database in the Database field, Connection timed out, Connection refused, Server not found, Server certificate not trusted with the Retry trusting the server certificate (less secure) button, Firewall blocked for the Azure SQL firewall, and on macOS Local network access blocked. Causes without a specific message, such as socket hang up and a named instance the Browser doesn’t know, get a plain Connection failed with the driver’s text. A retry that loosens certificate checking keeps the setting only if the retry connects. For a saved connection that fails from the connections list, the error offers Update user & password… for a rejected login on a connection that signs in with a user and password, and Edit connection… for timeouts, refused connections, unknown host names and missing databases. The dialog tests a connection before saving it, and Save anyway keeps one that failed. For a server you can reach only through a bastion host, the connection can use an SSH tunnel. The connections guide covers the dialog.

Quick Answers

Q: Why does SQL Server in Docker on my Mac say Login failed for user 'sa' when the password is right?

A: Usually the container did not get the password you think it did. In double quotes the shell expands $, so -e "MSSQL_SA_PASSWORD=Passw0rd2026$Jam" gave SQL Server Passw0rd2026. The reason is in the container's error log (State 8, Password did not match). Log in with the password the container has and run ALTER LOGIN sa WITH PASSWORD, or create the container again with the password in single quotes. Right after docker run, the sa login can also fail for about a second while setup finishes.

Q: Can I use Windows Authentication to connect to SQL Server from a Mac?

A: Not in Jam SQL Studio: it supports Windows Authentication only on Windows. In version 1.5.10, choosing it on a Mac sends a login with no user name and SQL Server answers Login failed for user ''. Version 1.5.11 and later do not offer it on macOS. Use a SQL Server login, or Microsoft Entra ID for Azure SQL and servers set up for it. Microsoft's ODBC driver for macOS supports Kerberos integrated authentication with a Kerberos ticket from kinit, for tools built on that driver.

Q: What does connect ECONNREFUSED 127.0.0.1:1433 mean on a Mac?

A: Nothing on your Mac is listening on port 1433. For SQL Server in Docker that means the container is stopped, exited during setup (docker logs shows why, for example a password that is too short), Docker Desktop is not running, or the container publishes a different host port. docker ps -a shows the status and docker port shows the port to enter.

Q: How do I fix the self-signed certificate error when connecting to SQL Server from a Mac?

A: SQL Server without an installed certificate presents a self-signed one, and a client that checks certificates refuses it. For a local container or a development server, turn on Trust server certificate (TrustServerCertificate=True, or -C for sqlcmd). For a server on a network you do not control, install a certificate from a certificate authority your Mac trusts instead.

Q: Why does localhost\SQLEXPRESS time out on a Mac?

A: A named instance is found through the SQL Server Browser service on UDP port 1434, which runs only on Windows. SQL Server on Linux and in containers has a single default instance and no Browser, so nothing answers and the connection timed out after 30 seconds in our test. Connect to localhost and the container's port instead, or, for a Windows server, enter the instance's TCP port.

Q: Why can Terminal reach SQL Server on my local network but my Mac app cannot?

A: On macOS 15 and later, an app needs Local Network access to connect to addresses on your local network, and command-line tools run from Terminal are exempt, according to Apple. Turn the app on in System Settings, Privacy & Security, Local Network.

How we tested

All tests ran on November 10, 2026 on an x86-64 Linux machine with Docker Engine 29.7.2, against mcr.microsoft.com/mssql/server:2025-latest containers (SQL Server 2025 RTM-CU8, 17.0.4075.5): a shared test server for the read-only failures, and throwaway containers of our own for the password, startup, disabled-sa, stopped-container and port cases, removed afterwards. The driver messages come from the mssql 12.2.0 and tedious 19.1.3 packages that Jam SQL Studio uses to connect to SQL Server on macOS and Linux, with the app’s settings (encryption on, a 30-second connect timeout). The app’s own titles and messages come from running a test build with the same connection code as version 1.5.10 on that machine, and from its source for the macOS-only case. The timeout against a firewall used a public address that drops port 1433, replaced with <address> above; the unreachable address was an unused one on a local virtual network. We did not run anything on a Mac: Docker Desktop for Mac, Rosetta, macOS Local Network access, the macOS shell and the Azure SQL message are from the Apple, Docker, zsh and Microsoft pages linked above. The device counts are from Jam SQL Studio’s anonymous usage events.

Summary

On a Mac, most SQL Server connection failures are about the container more than the server. Login failed for user ‘sa’ with a password you know is right is often the shell changing the password inside double quotes; the error log says so, and ALTER LOGIN fixes it without losing the container. ECONNREFUSED on localhost means the container isn’t running or uses another port, socket hang up means it is still starting, and a 30-second timeout means nothing answered, which for localhost\SQLEXPRESS is expected: containers have no named instances. Windows Authentication doesn’t work from a Mac in Jam SQL Studio; use a SQL login or Microsoft Entra ID. For servers on your local network, check macOS Local Network access when Terminal gets through and the app doesn’t.

Last verified against learn.microsoft.com, docs.docker.com, developer.apple.com, support.apple.com and the zsh manual, and by reproducing every message with SQL Server 2025 CU8 containers, on 2026-11-10.

See the cause of a failed connection in the dialog

Jam SQL Studio names the cause of a failed SQL Server connection, keeps the driver’s message one click away, and offers a fix where one exists. Native builds for Apple Silicon and Intel.

Related