MSSQL refers to Microsoft SQL which is more compatible with windows machines. What if we want it in our macbook. Well we do that using docker.
You should follow following steps in order to install MS SQL Server in your macbook.
- Download and install Docker. {docker download}
- Open terminal
- Enter following command. This command will install microsoft sql server in your mac
- --> docker pull microsoft/mssql-server-linux
- Now set up the server name and password for your sql server using following command in terminal.
- --> docker run -d --name your_sql_server_name -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=SetYourPassword123' -p 1433:1433 microsoft/mssql-server-linux
- Note that the password should contain capital letter, small letter and number, otherwise you will face the popular problem that your sql server automatically shuts down after few seconds of start.
- You may want to install sql cli that allows you to type sql commands in terminal. For that command is:
- --> sudo npm install -g sql-cli
- Now you may get an error saying that "npm" was not found if you don't have node installed. Well there's a fix for that too. Install node in your mac from here try the above command of step 5 again then it should work.
- Now connect to you sql server with below command. Enter your password that you used in step 4.
- -->mssql -u sa -p SetYourPassword123
- Now we don't have SQL server management studio for mac. Instead we use Azure Data Studio which you can download from here.
- After you installed Azure Data Studio, open it and click on "Add Connection" from its left panel. Then fill up the Connection details that appear in right bottom corner as below. Do as shown in picture below and enter your password "SetYourPassword123" that we set up in step 4. Click OK and you are connected.
That's it! You are done and good to go with ms sql. You can find your_sql_server_name in docker as well.
Thanks for reading.
Comments
Post a Comment