问题
I would like to connect SQl server DB in VM using my local sql server management studio.
What should I need for server name ? Can I use my server Windows authentication for VM in my local ?
回答1:
Create an empty text file on your VM and give it extension .udl
Doubleclick on it now you can set the properties easy from combobox
Adjust the properties and click on "test connection" until it works
Now open the file in notepad and there you see a complete connection string.
Note that for SQL Server authentication you need to configure the protocol in SQL Server Configuration Manager
回答2:
When you are in Management studio on your local machine, you will need the hostname or IP address of the VM.
- For Windows Authentication, you will need an account on the local domain that both your workstation and the database VM are connected to.
- For SQL server authentication, you will need an account in the SQL Server instance.
In both cases, security will need to be configured and associated with your account.
Are you on a domain, or is this just a private server?
回答3:
Use name of the VM where SQL server is running.
And yes, you can use Windows authentication. Depending on your domain settings.
This will help you How to: Create a SQL Server Login It is not much difference from SQL login.
And if you are in Administrators group on machine running SQL Server, then your login already should be included.
And if your machine with Management Studio and server with SQL Server are in different domains, then you will need to run Management Studio under different account
runas /netonly /user:domain\username "c:\path\ssms.exe"
See Connect to SQL Servers in another domain using Windows Authentication
来源:https://stackoverflow.com/questions/44828682/connect-to-sql-server-in-vm-using-local-machine