Take the SQL Server Mac challenge

This post has been republished via RSS; it originally appeared at: New blog articles in Microsoft Community Hub.

When I graduated from college, one of the first computers I ever used was a MacIntosh. I loved the Mac, the user interface, and the overall footprint of that computer. I also started my career developing on UNIX systems with C++ and databases like Ingres. As I moved to other jobs, the PC was becoming very popular as was the Windows Operating System. When I joined Microsoft in 1993, I would embark on a 25-year journey working only on Windows laptops and Windows Server computers.  And then in 2017 we launched SQL Server on Linux, which includes support for containers.

 

Since then, I have spent some of my time talking to customers directly and at events about SQL Server on Linux. At one of these events some time ago in London (you may have heard of SQLBits), I was presenting on SQL Server on Linux and someone in the audience asked me this question. "Bob, I love what Microsoft is doing with Linux but I'm a MacBook user. I want to use my MacBook and run SQL Server on it". I thought for a second on this question and then came up with the idea of the "SQL Server Mac Challenge". I told the audience that with a reasonable internet connection, I could get any MacBook user up and running and connected to SQL Server with no Windows software in 5 minutes or less. The person in the audience took me up on my challenge and posted something on Twitter the next day that it worked! So here in this blog post, I will show you my journey in taking the SQL Server Mac Challenge. I'm happy to tell you it took only 4 minutes on my MacBook Pro.

 

First, you need to download Docker for Mac as seen on this screenshot of the website to download

 

Picture1.png

 

The download is not too large and didn't take long on my internet connection. At the bottom right corner on my MacBook is an icon for downloads. I selected this to extract the downloaded image. When the image for Docker for Mac is extracted, a new window pops up so I can install it as an Application. I just used my mouse to drag the Docker icon on the Applications icon on this screen.

 

Picture2.png

 

When this completed, I selected the Launchpad application on the Dock and it shows the Docker application installed. I double-clicked the Docker Application. Now I see a new icon at the top status bar on my MacBook showing Docker is starting up.

 

Picture3.png

 

While Docker is starting up, I now decided to multi-task and download our cross-platform tool called Azure Data Studio. You can download the Mac version at https://aka.ms/azuredatastudio.

 

While Azure Data Studio is downloading, I can pull the docker image for SQL Server. The steps for pulling docker images for SQL Server can be found https://aka.ms/sqlcontainers. Since the terminal for MacBook is a bash shell, I just ran this command in the terminal

 

 

docker pull mcr.microsoft.com/mssql/server:2019-latest

 

 

After the docker pull is completed, I can start up a docker container with these commands:

 

 

docker run -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=<YourStrong@Passw0rd>” -p 1433:1433 --name sql1 --hostname sql1 -d mcr.microsoft.com/mssql/server:2019-latest

 

 

Notice the -p parameter which maps port 1433 to 1401. When I connect to this SQL Server I will use port 1401. When this completes SQL Server is now up and running in a Docker container. No Windows software is required.

 

Azure Data Studio has been extracted so I'll select that to install it as an application and launch it. Again, Azure Data Studio for Mac is a native Mac Application.

 

When Azure Data Studio launches it pops up a window for me to supply a server to connect to. I'll use the local IP address, port 1401, and the sa password I supplied when running the container. When I connect, Azure Data Studio shows an Object Explorer and dashboard. I run a query by right-clicking the Server and select New Query. And now I'll run SELECT @@version to prove I can run a query

 

There you have it. I did this in less than 5 minutes! So calling all MacBook users. Take the SQL Server Mac Challenge!

 

Authors note: I wrote this article a few years back but have now reposted this. Since then we have launched a preview for a new local Azure SQL Database development experience which uses containers and is supported on macOS: Read more at https://learn.microsoft.com/azure/azure-sql/database/local-dev-experience-sql-database-emulator.

 

Bob Ward

Microsoft

 

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.