Skip to content

Instantly share code, notes, and snippets.

@danigb
Last active May 23, 2018 15:42
Show Gist options
  • Save danigb/795b23394e165aef8ec30ac21b1f7ee0 to your computer and use it in GitHub Desktop.
Save danigb/795b23394e165aef8ec30ac21b1f7ee0 to your computer and use it in GitHub Desktop.
MSSQL Mac

Install MSSQL on Mac using Docker

1. Download docker

https://www.docker.com/community-edition

2. Download a Linux image with MSSQL preinstalled

docker pull microsoft/mssql-server-linux

3. Run the docker instance from the image

docker run -d --name mssql -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=d@ZLgum3' -e 'MSSQL_PID=Developer' -p 1433:1433 microsoft/mssql-server-linux

At this point, the only problem I had was that the password was too sort (and made docker instance to raise the error and stop). I used Kitematic to watch the logs and discover the problem. It requires an 8 or more character password with letters, numbers, and symbols.

4. Download mssql command line utilities

brew tap microsoft/mssql-release https://github.com/Microsoft/homebrew-mssql-release
brew update
HOMEBREW_NO_ENV_FILTERING=1 ACCEPT_EULA=y brew install --no-sandbox msodbcsql mssql-tools

5. Test everything works 🎉

sqlcmd -S 127.0.0.1 -U sa -P d@ZLgum3 -Q "SELECT @@VERSION"

(You should see the MSSQL version on the console)

6. Create a database

sqlcmd -S 127.0.0.1 -U sa -P d@ZLgum3 -Q "CREATE DATABASE <database-name>;"

7. Import sql data

sqlcmd -S 127.0.0.1 -U sa -P d@ZLgum3 -d <database-name> -i setup.sql


[1] Resources:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment