
MSSql database is easy to configure on a Windows System . For MacOs we need to take care of few steps to get it installed and run properly .
Lets see what all steps we need to follow →
01 : Download Docker
Docker is a set of platform as a service products that use OS-level virtualization to deliver software in packages called containers. We would need it to run Microsoft SQL on Mac.
→ Check docker version$ docker --version
→ Download and install docker from here 👉Docker Desktop
02 : Download the MS SQL Server Image to Docker
→ After that, you need to pull the SQL Server 2019 Linux container image from Microsoft Container Registry.
[Make sure docker is running in background ]
$ sudo docker pull mcr.microsoft.com/mssql/server:2019-latest
→ Then you can run the docker images command and verify whether the docker image has been pulled successfully.
03 : Run the docker container
→ Command to run the docker container.
🔥 Command to run the container docker run -d --name sql_server_demo -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=reallyStrongPwd123' -p 1433:1433 mcr.microsoft.com/mssql/server:2019-latest🔥 Command for M1 Chip, please try thisdocker run -e "ACCEPT_EULA=1" -e "MSSQL_SA_PASSWORD=reallyStrongPwd123" -e "MSSQL_PID=Developer" -e "MSSQL_USER=SA" -p 1433:1433 -d --name=sql mcr.microsoft.com/azure-sql-edge
→ Make sure to put you own password in SA_PASSWORD.
→ You can name your container after the --name flag.
→ -d flag represents the detach mode that releases the terminal after you run the above command.
→ Then run thedocker ps
command to verify whether your container has started to run
→ If your container stops after a few seconds it started, rundocker ps -a
command & > docker logs to check what’re the errors.
04 : Install the MS SQL CLI
→ Next, you need to installsql-cli via npm.
$ npm install -g sql-cliOR$ sudo npm install -g sql-cli
→Link to install npm if not present .
05 : Test the Installation by Login In
→ Testing the mssql integration by logging in
$ mssql -u sa -p <Your Pass word>
→ If correctly done :mssql>
prompt will come up.
→ Then runselect @@version
to verify the connectivity.
$ mssql -u sa -p reallyStrongPwd123Connecting to localhost...donesql-cli version 0.6.2Enter ".help" for usage hints.mssql> select @@version--------------------------------------------------------------------Microsoft SQL Server 2019 (RTM-CU15) (KB5008996) - 15.0.4198.2 (X64)Jan 12 2022 22:30:08Copyright (C) 2019 Microsoft CorporationDeveloper Edition (64-bit) on Linux (Ubuntu 20.04.3 LTS) <X64>1 row(s) returnedExecuted in 1 msmssql>
06 : [OPTIONAL] Download and install the GUI application - Azure Data Studio
07 : 😊 We Are Done ! Stop the services once completed with the work
→docker stop <container-id>
to stop the docker container.
Top comments(0)
For further actions, you may consider blocking this person and/orreporting abuse