MS SQL Server 開啟遠端連線
設定SA混合模式登入 SMSS方式
DB/設定/安全性
SQL Server 和 Windows 混合驗證模式
T-SQL方式
1 2 3 4 5 6 USE [master] GO EXEC xp_instance_regwrite N'HKEY_LOCAL_MACHINE' , N'Software\Microsoft\MSSQLServer\MSSQLServer' , N'LoginMode', REG_DWORD, 2 GO
SA安全性設定開啟登入
安全性=>狀態=>開啟登入
SQL Server 組態管理員 SQL Server 網路組態
啟用Shared Memory
啟用TCP/IP
啟用TCP/IP IPA11 TCP動態通訊埠
SQL Server 服務
啟用 SQL Server
啟用 SQL Server Browser (重要)
開啟防火牆 SQL Server 預設執行個體,TCP 通訊埠 1433
netsh firewall set portopening TCP 1433 "SQLServer"
專用管理員連接,TCP 通訊埠 1434 (預設執行個體)。其他通訊埠則用於具名執行個體。請檢查錯誤記錄檔,以取得通訊埠編號。
netsh firewall set portopening TCP 1434 "SQL Admin Connection"
Service Broker,TCP 通訊埠 4022。
netsh firewall set portopening TCP 4022 "SQL Service Broker"
Transact-SQL 偵錯工具,TCP 通訊埠 135
netsh firewall set portopening TCP 135 "SQL Debugger/RPC"
以下如果您有要使用Analysis Services請開下列 Port
Enabling SSAS Default Instance port 2383
netsh firewall set portopening TCP 2383 "Analysis Services"
Enabling SQL Server Browser Service port 2382
netsh firewall set portopening TCP 2382 "SQL Browser"
Script by ms 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 @echo ========= SQL Server Ports =================== @echo Enabling SQLServer default instance port 1433 netsh firewall set portopening TCP 1433 "SQLServer" @echo Enabling Dedicated Admin Connection port 1434 netsh firewall set portopening TCP 1434 "SQL Admin Connection" @echo Enabling conventional SQL Server Service Broker port 4022 netsh firewall set portopening TCP 4022 "SQL Service Broker" @echo Enabling Transact-SQL Debugger/RPC port 135 netsh firewall set portopening TCP 135 "SQL Debugger/RPC" @echo ========= Analysis Services Ports ============== @echo Enabling SSAS Default Instance port 2383 netsh firewall set portopening TCP 2383 "Analysis Services" @echo Enabling SQL Server Browser Service port 2382 netsh firewall set portopening TCP 2382 "SQL Browser" @echo ========= Misc Applications ============== @echo Enabling HTTP port 80 netsh firewall set portopening TCP 80 "HTTP" @echo Enabling SSL port 443 netsh firewall set portopening TCP 443 "SSL" @echo Enabling port for SQL Server Browser Service's 'Browse' Button netsh firewall set portopening UDP 1434 "SQL Browser" @echo Allowing multicast broadcast response on UDP (Browser Service Enumerations OK) netsh firewall set multicastbroadcastresponse ENABLE
Reference 從遠端連接 SQL Server 2012(含 Express 版) 之 FAQ
SQL Server 無敵手冊第三篇- 為SQL Server設定防火牆
SQL Server常用Port及防火牆設定
如何在 Windows Server 2008 上的 SQL Server 的開啟防火牆連接埠