Return to site

Microsoft Sql Server Management Studio For Mac

broken image


This guide shows you how to use Docker to pull a MSSQL Server image and run it. Azure Data Studio is a cross-platform database tool that will be using to connect our Docker container with MSSQL and execute SQL statements.

Step-by-step guide on how to connect to SQL Server using DBeaver on a Mac. Screenshots included. DBeaver is a database management tool for managing DBs such as MySQL, PostgreSQL, MariaDB, SQLite, Oracle, DB2, SQL Server, Sybase, MS Access, Teradata, Firebird, Derby, etc. There is not, but as of November SQL Operations Studio is in public preview and runs on Mac. It's not a replacement for SSMS but rather is aimed at developers for writing, testing, and executing code. It also provides limited administrative functionality and is customizable and extensible. It has a long way to go but is a good first start.

At the end, I will show you how to import a database to the Docker file system so that you can access it through Azure Data Studio.

Check out other related guides here:

Description Microsoft SQL Server Management Studio Express (SSMSE) is a free, easy-to-use graphical management tool for managing SQL Server 2005 Express Edition and SQL Server 2005 Express Edition with Advanced Services. The tool includes both script editors and graphical tools which work with objects and features of the server. Use SQL Server for Development on MAC OS I want to use SQL Server for carrying out development activities using SSIS and SSRS, but i have a Mac Book. Can i install Windows using VMWare or any other similar software and then install windows on it with required software.

We will be touching on the technologies shown below:

  • Database: Microsoft SQL Server
  • Container to pull mssql-server-demo: Docker
  • Installer for mssql-cli: Node.js (Run-time Environment) / Node Package Manager (NPM)
  • Database tool and GUI: Azure Data Studio

Building our Environment with Docker

Installing Docker

Full guide for this portion here:

  1. Download Docker CE (Community Edition) for Mac here.
  2. To install, double-click on the .dmg file and then drag the Docker application icon to your Application folder.

What is Docker?

Docker is a platform that enables software to run in its own isolated environment. SQL Server (from 2017) can be run on Docker in its own isolated container.

Once Docker is installed, you simply download — or 'pull' — the SQL Server on Linux Docker Image to your Mac, then run it as a Docker container. This container is an isolated environment that contains everything SQL Server needs to run.

Launch Docker

Open your Docker application, it should be located in the Applications folder.

Increase the Memory

By default, Docker will have 2GB of memory allocated to it. SQL Server needs at least 3.25GB. To be safe, increase it to 4GB if you can. Since this is just a playground, 2GB should be enough.

Optional - in case you want to increase memory size:

  1. Select Preferences from the little Docker icon in the top menu
  2. Slide the memory slider up to at least 2GB
  3. Click Apply & Restart

Download SQL Server

Open a Terminal window and run the following command.

Idatabase for mac review. This downloads the latest SQL Server 2019 for Linux Docker image to your computer.

You can also check for the latest container version on the Docker website if you wish.

Launch Docker Image

Run the following command to launch an instance of the Docker image you just downloaded:

Example output:

Check the Docker container (optional)

You can type the following command to check that the Docker container is running.

If it's up and running, it should return something like this:

If you accidentally closed your Docker App, open your terminal and type

Install the Node.js and NPM

Check if you have Node.js and NPM. Run the following commands in your terminal.

If you get an output with a version number, skip the rest of this section.

Then visit the Node.js website by clicking the following link:

Click the LTS version (the version number may be various) download button to download the Node.js package:

Next click and run the package after downloading. MacOS and Windows will have different installation process. Please follow the instruction to install the Node.js.

Then test again if Node.js and NPM were installed successfully by running the following commands in the terminal:

An output should look like this:

Install sql-cli

Run the following command to install the sql-cli command line tool. This tool allows you to run queries and other commands against your SQL Server instance.

If you get a permission error, use the sudo command:

Connect to MSSQL Server

Connect to your SQL Server using the mssql command, followed by the username and password parameters. Syntax: -u -p

Your output should look like this if you successfully connected:

Run a Quick Test

Run a quick test to check if you can connect to your SQL Server. Use the following SQL statement to check your SQL Server version:

If it's running, you should see something like this:

Download an SQL Server GUI - Azure Data Studio

Azure Data Studio (formerly SQL Operations Studio) is a free GUI management tool that you can use to manage SQL Server on your computer. You can use it to create and manage databases, write queries, backup and restore databases, and more.

Microsoft Sql Server Management Studio For Mac

Azure Data Studio is available on Windows, Mac and Linux.

Install Azure Data Studio

To install Azure Data Studio onto your Mac:

  1. Visit the Azure Data Studio download page, and click the .zip file for macOS
  2. Once the .zip file has finished downloading, double click it to expand its contents
  3. Drag the .app file to the Applications folder (the file will probably be called Azure Data Studio.app)

Connect to SQL Server

Now that Azure Data Studio is installed, you can use it to connect to SQL Server.

  1. Launch Azure Data Studio. It is located in your Applications folder.
  2. Enter the login credentials and other information for the SQL Server instance that you'd like to connect to:

It should look similar to this:

It should look similar to this:

  • Server Name: localhost, [port number]
    Example: localhost, 1433
  • Authentication Type: SQL Login
  • User name: [your SQL Server username] or sa
  • Password: [your SQL Server password] or reallyStrongPwd123
  • Database Name:
  • Server Group:

If you use a port other than the default 1433, click Advanced and enter it in the Port field.

Alternatively, you can append it to your server name with a comma in between. For example, if you used port 1400, type in localhost,1400.

You can now go ahead and create databases, run scripts, and perform other SQL Server management tasks.

  1. Click New Query

2. Type SELECT @@VERSION, then Click Run Query.

You should be able to see: Microsoft SQL Server in the Results.

Importing a sample database to your SQL Server using Azure Data Studio

Download the sample database file AdventureWorks

To get the OLTP downloads of AdventureWorks, go to this link and choose any sample database. In my example, I choose AdventureWorks2017.bak. We will upload this to the S3 Bucket.

Copying the file to your docker

Type the following command in the terminal following this syntax:

It should look like this:

If you forgot your container id, use the docker ps command.

Importing the sample database in Docker

Go to Azure Data Studio, and click the localhost, 1443, then choose Restore.

Then choose Backup file as the selection for Restore from. Next, click the blue button on the right of Backup file path.

Look for the sample database file. It should be located in

Choose Restore.

Check your localhost, 1443. It should generated a Database named AdventureWorks2017 and have contents such as Tables and Views. If not, right-click on localhost, 1443 and choose Refresh. You can also restart your Azure Data Studio application.

Testing the sample database

  1. Choose AdventureWorks2017 from the dropdown menu.
  2. Write a SQL query:

3. Click Run to run the query.

You should have an output like this:

Congratulations! ???

Sql

Resources:

Connect with me on LinkedIn here

Here I'll show you how to get SQL Server up and running on your Mac in less than half an hour. And the best part is, you'll have SQL Server running locally without needing any virtualization software.

Prior to SQL Server 2017, if you wanted to run SQL Server on your Mac, you first had to create a virtual machine (using VirtualBox, Parallels Desktop, VMware Fusion, or Bootcamp), then install Windows onto that VM, then finally SQL Server. This is still a valid option depending on your requirements (here's how to install SQL Server on a Mac with VirtualBox if you'd like to try that method).

Starting with SQL Server 2017, you can now install SQL Server directly on to a Linux machine. And because macOS is Unix based (and Linux is Unix based), you can run SQL Server for Linux on your Mac. The way to do this is to run SQL Server on Docker.

So let's go ahead and install Docker. Then we'll download and install SQL Server.

  1. Install Docker

    Download the (free) Docker Community Edition for Mac (unless you've already got it installed on your system). This will enable you to run SQL Server from within a Docker container.

    To download, visit the Docker CE for Mac download page and click Get Docker.

    To install, double-click on the .dmg file and then drag the Docker.app icon to your Application folder.

    What is Docker?

    Docker is a platform that enables software to run in its own isolated environment. SQL Server (from 2017) can be run on Docker in its own isolated container. Once Docker is installed, you simply download — or 'pull' — the SQL Server on Linux Docker Image to your Mac, then run it as a Docker container. This container is an isolated environment that contains everything SQL Server needs to run.

  2. Launch Docker

    Launch Docker the same way you'd launch any other application (eg, via the Applications folder, the Launchpad, etc).

    When you open Docker, you might be prompted for your password so that Docker can install its networking components and links to the Docker apps. Go ahead and provide your password, as Docker needs this to run.

  3. Increase the Memory (optional)

    By default, Docker will have 2GB of memory allocated to it. SQL Server needs at least 2GB. However, it won't hurt to increase it if you can.

    In my case, I increased it to 4GB.

    To do this, select Preferences from the little Docker icon in the top menu:

    Then finish off by clicking Apply & Restart

  4. Download SQL Server

    Now that Docker is installed, we can download and install SQL Server for Linux.

    Open a Terminal window and run the following command.

    This downloads the latest SQL Server 2019 for Linux Docker image to your computer.

    You can also check for the latest container version on the Docker website if you wish.

  5. Launch the Docker Image

    Run the following command to launch an instance of the Docker image you just downloaded:

    But of course, use your own name and password. Also, if you downloaded a different Docker image, replace mcr.microsoft.com/mssql/server:2019-latest with the one you downloaded.

    Here's an explanation of the parameters:

    -dThis optional parameter launches the Docker container in daemon mode. This means that it runs in the background and doesn't need its own Terminal window open. You can omit this parameter to have the container run in its own Terminal window.
    --name sql_server_demoAnother optional parameter. This parameter allows you to name the container. This can be handy when stopping and starting your container from the Terminal.
    -e 'ACCEPT_EULA=Y'The Y shows that you agree with the EULA (End User Licence Agreement). This is required in order to have SQL Server for Linux run on your Mac.
    -e 'SA_PASSWORD=reallyStrongPwd123'Required parameter that sets the sa database password.
    -p 1433:1433This maps the local port 1433 to port 1433 on the container. This is the default TCP port that SQL Server uses to listen for connections.
    mcr.microsoft.com/mssql/server:2019-latestThis tells Docker which image to use. If you downloaded a different one, use it instead.

    Password Strength

    If you get the following error at this step, try again, but with a stronger password.

    I received this error when using reallyStrongPwd as the password (but of course, it's not a really strong password!). I was able to overcome this by adding some numbers to the end. However, if it wasn't just a demo I'd definitely make it stronger than a few dictionary words and numbers.

  6. Check the Docker container (optional)

    You can type the following command to check that the Docker container is running.

    If it's up and running, it should return something like this:

  7. Install sql-cli (unless already installed)

    Run the following command to install the sql-cli command line tool. This tool allows you to run queries and other commands against your SQL Server instance.

    This assumes you have NodeJs installed. If you don't, download it from Nodejs.org first. Installing NodeJs will automatically install npm which is what we use in this command to install sql-cli.

    Permissions Error?

    If you get an error, and part of it reads something like Please try running this command again as root/Administrator, try again, but this time prepend sudo to your command:

  8. Connect to SQL Server

    Now that sql-cli is installed, we can start working with SQL Server via the Terminal window on our Mac.

    Connect to SQL Server using the mssql command, followed by the username and password parameters.

    You should see something like this:

    This means you've successfully connected to your instance of SQL Server.

  9. Run a Quick Test

    Run a quick test to check that SQL Server is up and running and you can query it.

    For example, you can run the following command to see which version of SQL Server your running:

    If it's running, you should see something like this (but of course, this will depend on which version you're running):

    If you see a message like this, congratulations — SQL Server is now up and running on your Mac!

A SQL Server GUI for your Mac – Azure Data Studio

Azure Data Studio (formerly SQL Operations Studio) is a free GUI management tool that you can use to manage SQL Server on your Mac. You can use it to create and manage databases, write queries, backup and restore databases, and more.

For

Azure Data Studio is available on Windows, Mac and Linux.

Install Azure Data Studio

To install Azure Data Studio onto your Mac:

  1. Visit the Azure Data Studio download page, and click the .zip file for macOS
  2. Once the .zip file has finished downloading, double click it to expand its contents
  3. Drag the .app file to the Applications folder (the file will probably be called Azure Data Studio.app)

Connect to SQL Server

Now that Azure Data Studio is installed, you can use it to connect to SQL Server.

  1. Launch Azure Data Studio. It is located in your Applications folder.
  2. Enter the login credentials and other information for the SQL Server instance that you'd like to connect to:

It should look similar to this:

It should look similar to this:

  • Server Name: localhost, [port number]
    Example: localhost, 1433
  • Authentication Type: SQL Login
  • User name: [your SQL Server username] or sa
  • Password: [your SQL Server password] or reallyStrongPwd123
  • Database Name:
  • Server Group:

If you use a port other than the default 1433, click Advanced and enter it in the Port field.

Alternatively, you can append it to your server name with a comma in between. For example, if you used port 1400, type in localhost,1400.

You can now go ahead and create databases, run scripts, and perform other SQL Server management tasks.

  1. Click New Query

2. Type SELECT @@VERSION, then Click Run Query.

You should be able to see: Microsoft SQL Server in the Results.

Importing a sample database to your SQL Server using Azure Data Studio

Download the sample database file AdventureWorks

To get the OLTP downloads of AdventureWorks, go to this link and choose any sample database. In my example, I choose AdventureWorks2017.bak. We will upload this to the S3 Bucket.

Copying the file to your docker

Type the following command in the terminal following this syntax:

It should look like this:

If you forgot your container id, use the docker ps command.

Importing the sample database in Docker

Go to Azure Data Studio, and click the localhost, 1443, then choose Restore.

Then choose Backup file as the selection for Restore from. Next, click the blue button on the right of Backup file path.

Look for the sample database file. It should be located in

Choose Restore.

Check your localhost, 1443. It should generated a Database named AdventureWorks2017 and have contents such as Tables and Views. If not, right-click on localhost, 1443 and choose Refresh. You can also restart your Azure Data Studio application.

Testing the sample database

  1. Choose AdventureWorks2017 from the dropdown menu.
  2. Write a SQL query:

3. Click Run to run the query.

You should have an output like this:

Congratulations! ???

Resources:

Connect with me on LinkedIn here

Here I'll show you how to get SQL Server up and running on your Mac in less than half an hour. And the best part is, you'll have SQL Server running locally without needing any virtualization software.

Prior to SQL Server 2017, if you wanted to run SQL Server on your Mac, you first had to create a virtual machine (using VirtualBox, Parallels Desktop, VMware Fusion, or Bootcamp), then install Windows onto that VM, then finally SQL Server. This is still a valid option depending on your requirements (here's how to install SQL Server on a Mac with VirtualBox if you'd like to try that method).

Starting with SQL Server 2017, you can now install SQL Server directly on to a Linux machine. And because macOS is Unix based (and Linux is Unix based), you can run SQL Server for Linux on your Mac. The way to do this is to run SQL Server on Docker.

So let's go ahead and install Docker. Then we'll download and install SQL Server.

  1. Install Docker

    Download the (free) Docker Community Edition for Mac (unless you've already got it installed on your system). This will enable you to run SQL Server from within a Docker container.

    To download, visit the Docker CE for Mac download page and click Get Docker.

    To install, double-click on the .dmg file and then drag the Docker.app icon to your Application folder.

    What is Docker?

    Docker is a platform that enables software to run in its own isolated environment. SQL Server (from 2017) can be run on Docker in its own isolated container. Once Docker is installed, you simply download — or 'pull' — the SQL Server on Linux Docker Image to your Mac, then run it as a Docker container. This container is an isolated environment that contains everything SQL Server needs to run.

  2. Launch Docker

    Launch Docker the same way you'd launch any other application (eg, via the Applications folder, the Launchpad, etc).

    When you open Docker, you might be prompted for your password so that Docker can install its networking components and links to the Docker apps. Go ahead and provide your password, as Docker needs this to run.

  3. Increase the Memory (optional)

    By default, Docker will have 2GB of memory allocated to it. SQL Server needs at least 2GB. However, it won't hurt to increase it if you can.

    In my case, I increased it to 4GB.

    To do this, select Preferences from the little Docker icon in the top menu:

    Then finish off by clicking Apply & Restart

  4. Download SQL Server

    Now that Docker is installed, we can download and install SQL Server for Linux.

    Open a Terminal window and run the following command.

    This downloads the latest SQL Server 2019 for Linux Docker image to your computer.

    You can also check for the latest container version on the Docker website if you wish.

  5. Launch the Docker Image

    Run the following command to launch an instance of the Docker image you just downloaded:

    But of course, use your own name and password. Also, if you downloaded a different Docker image, replace mcr.microsoft.com/mssql/server:2019-latest with the one you downloaded.

    Here's an explanation of the parameters:

    -dThis optional parameter launches the Docker container in daemon mode. This means that it runs in the background and doesn't need its own Terminal window open. You can omit this parameter to have the container run in its own Terminal window.
    --name sql_server_demoAnother optional parameter. This parameter allows you to name the container. This can be handy when stopping and starting your container from the Terminal.
    -e 'ACCEPT_EULA=Y'The Y shows that you agree with the EULA (End User Licence Agreement). This is required in order to have SQL Server for Linux run on your Mac.
    -e 'SA_PASSWORD=reallyStrongPwd123'Required parameter that sets the sa database password.
    -p 1433:1433This maps the local port 1433 to port 1433 on the container. This is the default TCP port that SQL Server uses to listen for connections.
    mcr.microsoft.com/mssql/server:2019-latestThis tells Docker which image to use. If you downloaded a different one, use it instead.

    Password Strength

    If you get the following error at this step, try again, but with a stronger password.

    I received this error when using reallyStrongPwd as the password (but of course, it's not a really strong password!). I was able to overcome this by adding some numbers to the end. However, if it wasn't just a demo I'd definitely make it stronger than a few dictionary words and numbers.

  6. Check the Docker container (optional)

    You can type the following command to check that the Docker container is running.

    If it's up and running, it should return something like this:

  7. Install sql-cli (unless already installed)

    Run the following command to install the sql-cli command line tool. This tool allows you to run queries and other commands against your SQL Server instance.

    This assumes you have NodeJs installed. If you don't, download it from Nodejs.org first. Installing NodeJs will automatically install npm which is what we use in this command to install sql-cli.

    Permissions Error?

    If you get an error, and part of it reads something like Please try running this command again as root/Administrator, try again, but this time prepend sudo to your command:

  8. Connect to SQL Server

    Now that sql-cli is installed, we can start working with SQL Server via the Terminal window on our Mac.

    Connect to SQL Server using the mssql command, followed by the username and password parameters.

    You should see something like this:

    This means you've successfully connected to your instance of SQL Server.

  9. Run a Quick Test

    Run a quick test to check that SQL Server is up and running and you can query it.

    For example, you can run the following command to see which version of SQL Server your running:

    If it's running, you should see something like this (but of course, this will depend on which version you're running):

    If you see a message like this, congratulations — SQL Server is now up and running on your Mac!

A SQL Server GUI for your Mac – Azure Data Studio

Azure Data Studio (formerly SQL Operations Studio) is a free GUI management tool that you can use to manage SQL Server on your Mac. You can use it to create and manage databases, write queries, backup and restore databases, and more.

Azure Data Studio is available on Windows, Mac and Linux.

Here are some articles/tutorials I've written for Azure Data Studio:

Another Free SQL Server GUI – DBeaver

Another SQL Server GUI tool that you can use on your Mac (and Windows/Linux/Solaris) is DBeaver.

DBeaver is a free, open source database management tool that can be used on most database management systems (such as MySQL, PostgreSQL, MariaDB, SQLite, Oracle, DB2, SQL Server, Sybase, Microsoft Access, Teradata, Firebird, Derby, and more).

Microsoft Sql Server Management Studio Mac Alternative

I wrote a little introduction to DBeaver, or you can go straight to the DBeaver download page and try it out with your new SQL Server installation.

Limitations of SQL Server for Linux/Mac

SQL Server for Linux does have some limitations when compared to the Windows editions (although this could change over time). The Linux release doesn't include many of the extra services that are available in the Windows release, such as Analysis Services, Reporting Services, etc. Here's a list of what's available and what's not on SQL Server 2017 for Linux and here's Microsoft's list of Editions and supported features of SQL Server 2019 on Linux.

Microsoft Sql Server Management Studio Macros

Another limitation is that SQL Server Management Studio is not available on Mac or Linux. SSMS a full-blown GUI management for SQL Server, and it provides many more features than Azure Data Studio and DBeaver (at least at the time of writing). You can still use SSMS on a Windows machine to connect to SQL Server on a Linux or Mac machine, but you just can't install it locally on the Linux or Mac machine.

If you need any of the features not supported in SQL Server for Linux, you'll need SQL Server for Windows. However, you can still run SQL Server for Windows on your Mac by using virtualization software. Here's how to install SQL Server for Windows on a Mac using VirtualBox.





broken image