Work with SQL Server in Mac like in Windows

Hi all Mac and SQL Server lovers,

In this blog post I will explain you how to work with SQL Server in your mac like in a windows machine. Lets start.

Start SQL Server in Mac 

1. Install docker (https://hub.docker.com/editions/community/docker-ce-desktop-mac)
2. Increase the memory to 4 GB
You can do this by going to docker --> Preferences --> Advanced

 
3. Open the terminal and type bellow command 

docker run --name sql3 -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=sysAdmin@123' -p 1433:1433 mcr.microsoft.com/mssql/server:2017-latest-ubuntu

This will download and install SQL Server 2017 for linux
If you want different version of SQL Server, then you can find it from here: https://hub.docker.com/_/microsoft-mssql-server

NOTE: When providing a password for  sa (System Admin), it should meet the following criteria: 
  • At least 8 characters long
  • contain characters from three of the following four sets: Uppercase letters, Lowercase letters, Base 10 digits, and Symbols

You can check the status of the container by running 'docker container ls' command. 
This will provide you the state as 'Up (x) minutes' (Ex: Up 25 minutes)

Use Azure Data Studio


5. Open Azure Data Studio and click on new connection to connect to created sql instance. 

6. Give sql connection details as bellow



7. Follow the Azure Data Studio Quick Start Guide from https://docs.microsoft.com/en-us/sql/azure-data-studio/quickstart-sql-server?view=sql-server-2017 to interact with SQL Server. 

Troubleshooting 

Sometimes Azure Data Studio (ADS) cannot connect to the SQL Server
  • Go to terminal and type 'docker ps -a' and check the status of the container. 
  • If the container has stopped type 'docker start [container id]'.
  • And try reconnecting in ADS.  


Happy quarrying... 










Comments

Popular posts from this blog

Deploy Angular 8 app to Azure with Azure DevOps

Apache ActiveMQ 5 with .Net Core 3.1 and C#

Firebase with.Net Core and C#