問題描述
我在 Virtualbox 下的 Windows 7 虛擬機(jī)中將 MSSQL 備份恢復(fù)到 SQL Server Express.我正在嘗試使用導(dǎo)入數(shù)據(jù)庫中具有連接憑據(jù)的用戶從主機(jī) (Mac OS) 連接到此 SQL Server 實(shí)例.虛擬機(jī)配置為使用 Host-Only 適配器.SQL Server express 在 WIN7VM/SQLEXPRESS 的 VM 內(nèi)運(yùn)行,端口為 1433.
I restored a MSSQL backup to SQL Server Express in a Windows 7 virtual machine under Virtualbox. I am attempting to connect to this SQL Server instance from the host (Mac OS) using a user inside the imported database that has credentials to connect. The virtual machine is configured to use a Host-Only adapter. SQL Server express is running inside the VM at WIN7VM/SQLEXPRESS, port 1433.
我能夠從 Mac 主機(jī)通過端口 8080 連接到 VM 中的 Apache,沒有任何問題.我還可以使用僅限主機(jī)的 IP 地址 (192.168.56.101) 從 Mac 主機(jī)通過 1433 端口 telnet 到 SQL 服務(wù)器.
I am able to connect to Apache in the VM on port 8080 from the Mac host without a problem. I can also telnet into the SQL server at port 1433 from the Mac host, using the host-only IP address (192.168.56.101).
我無法做的是從 MacOS 中的 Navicat 連接到 SQL 服務(wù)器,或者使用 PHP 遠(yuǎn)程連接.這是我嘗試過的:
What I am unable to do is connect to SQL server from Navicat in MacOS, or remotely using PHP. Here is what I have tried:
- 禁用 Windows 防火墻
- 配置 SQL 服務(wù)器端口設(shè)置以使用 1433
- 啟用 SQL 服務(wù)器身份驗(yàn)證
- 在 SQL Server 中啟用 TCP/IP
- 啟用到 SQL 服務(wù)器的遠(yuǎn)程連接
我正在嘗試連接此信息:
I am trying to connect with this info:
- 主機(jī)/IP 地址:192.168.56.101 OR 192.168.56.101\SQLEXPRESS(兩者都試過了)
- 端口:1433
- 數(shù)據(jù)庫:MyDatabase
- 身份驗(yàn)證類型:基本
- 用戶名:用戶名
- 密碼:密碼
我在這里缺少什么才能遠(yuǎn)程連接而沒有任何問題?提前致謝!
What am I missing here to be able to remotely connect without any issues? Thanks in advance!
推薦答案
原來不是 Virtualbox 問題,而是 SQL Server 身份驗(yàn)證問題.
It turned out to not be a Virtualbox issue, but a SQL Server authentication issue.
我嘗試連接的用戶可以訪問數(shù)據(jù)庫,但沒有相應(yīng)的 SQL Server 登錄名.
The user I was trying to connect with had access to a database, but did not have a corresponding SQL Server Login.
MSDN - 管理登錄名、用戶和架構(gòu)操作方法主題
這篇關(guān)于如何從 Mac 主機(jī)連接到 Win7 虛擬機(jī)中的 SQL Server?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!