How to Install SQL Server and Azure for Mac

We need a database and a database management application to start familiarizing and learning database management with SQL language. There are many famous database types, but using Microsoft SQL Server is the most accessible to begin learning. Although not supported as much as Windows, Mac still has many excellent replacement applications to install SQL Server on Mac and manage databases on Mac, which are Docker and Azure. Now let’s install Lucid Gen.

Virtual machineSQL Server
CompatibleARM và Intel
Application requiredDocker, Azure Data Studio
PriceFree

Install SQL Server on Mac using Docker

To create a SQL Server right on Mac, the most recommended tool is Docker. Please do it in turn in the order of the instructions. First, you must check if your Mac is an Intel or Apple M1 chip.

Kiểm tra chip và macOS của Mac
Check Mac’s Chips and macOS

Mac chip Apple M1

According to information from Docker’s manual page, if you are using Mac chip Apple M1 then you need to install Rosetta 2 because some binaries of this application are still Darwin/AMD64.

You click to open the Terminal application available on Mac (use Command-Space to find Terminal) > paste the code below and then Enter > type A to agree to the terms.

softwareupdate --install-rosetta
Cài đặt Rosetta để sử dụng Docker trên Mac chip M1
Install Rosetta to use Docker on Mac chip M1

Download and install Docker

Step 1: Click the button below to download Docker for Mac, and choose the correct version for your Mac.

Step 2: Open the Docker installation file > drag and drop the Docker icon into the Applications folder.

Cài đặt Docker trên MAc
Install Docker on MAC

Step 3: You open Docker > go to Settings > Resources > increase Memory to about 4GB. This parameter is neither less nor much, suitable for a simple SQL Server.

Thiết lập dung lượng RAM cho Docker trên Mac
Set RAM for Docker on Mac

Temporarily you hide Docker, and we proceed to install SQL Server according to the instructions below.

Initialize SQL Server (Azure SQL Edge)

Step 1: You open Terminal> paste the code below and Enter> enter the password to open the machine (while typing, it will not display anything, enter it correctly) and Enter.

sudo docker pull mcr.microsoft.com/azure-sql-edge:latest
Cài đặt Azure SQL Edge trên Mac
Install Azure SQL Edge on Mac

Step 2: You continue to paste the code below into Terminal and Enter> enter the password to open the machine and Enter.

sudo docker run --cap-add SYS_PTRACE -e 'ACCEPT_EULA=1' -e 'MSSQL_SA_PASSWORD=Password.1' -p 1433:1433 --name azuresqledge -d mcr.microsoft.com/azure-sql-edge

You can change Password.1 to another password you want.

Note: SQL Server password requires the following:
– At least 8 characters.
– Contains lowercase letters, uppercase letters, numbers, and special characters.

Khởi tạo Microsoft SQL Server trên Mac
Initialize Microsoft SQL Server on Mac

If you want to change the password after creating SQL Server, you can use this command in Terminal.

sudo docker exec -it azuresqledge /opt/mssql-tools/bin/sqlcmd \
   -S localhost -U SA -P "<Old_Password>" \
   -Q 'ALTER LOGIN SA WITH PASSWORD="<New_Password>"'

Step 3: You open Docker > Containers / Apps > make sure there is a SQL Server named azuresqledge running; its status will be RUNNING. If it is off, click the play icon to make it run.

You can pause, restart, and delete SQL Server right in the Docker interface.

Đảm bảo là SQL Server đang chạy trên Mac
Make sure SQL Server is running on Mac

That’s it, and you already have a primary SQL Server on your Mac. Now that you can sleep Docker, we will proceed to install Azure to work with this SQL Server.

Install Azure Data Studio on Mac

Azure Data Studio is a portable Microsoft application (no need to install, open and use). It is designed only to work with Microsoft SQL Server or Azure SQL Server; of course, it is perfect. As for other types of databases, many other applications will support them, and you will find out later when you meet them.

Step 1: You download Azure Data Studio for Mac with the button below > download the zip file in the macOS line.

Step 2: Double-click the zip file to extract it > open Azure Data Studio > click Add Connection or Create a connection > enter SQL Server connection information as follows:

  • Server: localhost
  • Authentication type: SQL login
  • User name: sa
  • Pass: Password.1
Connect to SQL Server using Azure Data Studio on Mac
Connect to SQL Server using Azure Data Studio on Mac

And this is what it looks like to work with SQL Server on Azure Data Studio; now you’re done and ready to learn the SQL language.

Interface to work with SQL Server in Azure Data Studio on Mac
Interface to work with SQL Server in Azure Data Studio on Mac

Conclusion

There are many applications available for working with databases, not just Microsoft products. Lucid Gen has discovered that in Vietnam, many users prefer Navicat, and I personally find Navicat’s interface quite user-friendly. It also supports several other well-known databases. In the following article, I will guide you on how to install Navicat on your Mac.

Related articles

Hieu Tran Ngoc Minh

Hieu Tran Ngoc Minh

I am currently working as a Data Analyst; before that, I worked in Digital Marketing. Blogging is a joy, helping me share my knowledge and experiences from life and work. You can donate to me here.

6 thoughts on “How to Install SQL Server and Azure for Mac”

  1. I followed the instructions and everything was up and running, but today I got an error – azure data studio now says it requires parallels to run. what can I do?

    Reply
    • Hello, please try to restart your Mac or force quit all anything related to Docker in the Activity Monitor. Docker has some problems with the recent version.

  2. Hi! When we try to connect to the SQL Server, many times we get an Error as Provider: Named Pipes Provider, Error: 40 – could not open a connection to SQL server.

    Reply
    • Hello, try to restart the SQL sever, search your error on Stackoverflow.

Leave a Comment

Feel free to leave your comment, and we will review and respond as soon as possible. Please use a real email to ensure your comment is approved and to receive notifications when we reply. You can also add an avatar to your email.