I want to run SQLServer on my Mac but I can't do it natively. How can I host a SQLServer with VirtualBox and connect to it from my MacBook for local development?
First, connect to the SQL Server virtual machine with remote desktop. After the Azure virtual machine is created and running, click the Virtual Machines icon in the Azure portal to view your VMs. Click the ellipsis, ..., for your new VM. Click Connect.
SQL Server on Azure Virtual Machines enables you to use full versions of SQL Server in the cloud without having to manage any on-premises hardware. SQL Server virtual machines (VMs) also simplify licensing costs when you pay as you go. Azure virtual machines run in many different geographic regions around the world.
testdatabase
) 8.1. Create a new Login: right click on Security > New > Login...
Be sure to select the SQL Server authentication
option.
8.2. In the Server Roles
tab, select the sysadmin
option:
8.3. In the User Mapping
tab, map the login to the database, and check all assign the role memberships:
Security
tab, and switch the Server Authentication mode
to SQL Server and Windows Authentication mode
:SQL Server Browser
. Open its properties and change the Startup type
to automatic:11.1. Open the Sql Server Configuration Manager program. Navigate to the Protocols
under the SQL Server Network Configuration
and Enable the TCP/IP
option:
11.2. Open the TCP/IP
properties switch to the IP Addresses tab
. Make a note of the IP Address
field under IP2
(you will need this later):
11.3. Set the TCP Port
under IPALL
to 1433
:
Configure the Firewall on the Windows VirtualBox to allow 1433 to be unblocked (I just disabled the whole firewall, probably not the best option.) edit: another user has kindly added the steps for adding a firewall rule to the end of this post.
In your Macbook's VirtualBox app, open the settings for the Windows VM and go to the Network
tab. Set the Attached to
dropdown to NAT
, then click Port Forwarding
. Add a rule to forward the VM's 1433 port to your localhost's 1433 port. The Guest IP
will be the IP from Step 11.2:
You should now be able to connect to your SQLServer from your macbook with a connection string something like this:
jdbc:sqlserver://127.0.0.1;databaseName=testdatabase
Steps to open a port in the Windows firewall for TCP access
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With