How To Download Sql Server On Mac
Since the release of .Cyberspace Core 1.0 in 2014, .Net developers have no longer been confined to development on Windows. Yet I am all the same surprised by how many people don't realise that .NET Core is cantankerous-platform!
I develop all my .NET code, from web apps to Azure Functions, using Microsoft SQL Server on macOS.
Nosotros will use a Docker container to host SQL server, which ways this technique could also exist used on Windows and Linux and not just macOS.
If you would like to come across a total integration of Twilio APIs in a .NET Core application, then check out this free 5-part video serial. Information technology's split from this web log postal service tutorial but will give you lot a full rundown of many APIs at once.
Microsoft SQL Server on macOS: Getting Started with Docker
To get started we will demand to download Docker for Mac and follow the installation instructions.
One time installed, the offset thing we will demand to do is increment Docker'southward default memory allocation as SQL Server will require a bit more than grunt.
Click on the Docker daemon icon in the top menu and select "Preferences".
Next, choose the "Resource" tab, note - on some versions of Docker you may notice it under the "Avant-garde" tab, and adjust the memory slider to be at least 4GB. Then click "Apply and Restart"
How to Install SQL Server on Mac
Nosotros can install the SQL Server on the Mac and run the Server paradigm all at one time by running the following command in the last.
docker run -d --name sql_server -e 'ACCEPT_EULA=Y' -due east 'SA_PASSWORD=someThingComplicated1234' -p 1433:1433 mcr.microsoft.com/mssql/server:2019-latest There are several parameters in the above command, so let'due south take a closer look at each one.
-
-dwill launch the container in "detached" way and is optional. This means that containers will run in the background and you tin can close the terminal window. -
--proper name sql_serverwill assign a name to the container and is optional, but recommended for easier management! -
-ewill let yous to prepare surroundings variables:
-
'ACCEPT_EULA=Y'SQL Server requires the user to accept the "Finish User Licence Agreement" or EULA. TheYhere indicates acceptance. -
'SA_PASSWORD=someThingComplicated1234'is a required parameter for SQL Server. This is the System Administrator password. See the note beneath on password strength.
-
-
-p 1433:1433volition map the local port 1433 to port 1433 on the container. Port 1433 is the default TCP port that SQL Server will listen on. - mcr.microsoft.com/mssql/server:2019-latest is the epitome we wish to run. I accept used the latest version of 2019, yet, if you demand a dissimilar version y'all tin cheque out the Microsoft SQL Server page on Docker Hub.
For more information on docker runcommands, bank check out the documentation.
Note on Password Force
If you find your image starts but then immediately stops or you get an error such as setup failed with fault code one`, then it may exist y'all haven't created a strong enough countersign. SQL Server really ways it when it requests a stiff countersign. Ensure expert length with a mixture of upper and lower instance, and a mix of alphanumeric characters. For more information on password requirements take a look at the Microsoft documentation.
Using the SQL CLI tool
The SQL CLI tool is a convenient command-line tool for querying SQL databases and is cross-platform. It's also actually useful for checking to see if the to a higher place worked!
To install it, run the post-obit control in the terminal:
Then, to connect to you database:
mssql -u sa -p someThingComplicated1234 Where someThingComplicated1234 is your password.
You should receive a response similar to below:
Connecting to localhost...done sql-cli version 0.6.2 Enter ".help" for usage hints. mssql> Azure Data Studio
Some other hurdle with using SQL Server on macOS is the lack of SQL Server Management Studio (SSMS), a software tool that is used for configuring, managing, and administering all components within Microsoft SQL Server. Information technology includes scripting tools for creating and running queries and graphical tools for utilize with objects and features within SQL Server.
Still, Azure Data Studio has got y'all covered.
Click the "New connection" link and enter localhost for the "Server" input, sa for the "User name" input, and then your password for the "Password" input.
The other inputs are optional.
One time you've logged in you should have a view similar to the one beneath, with all the databases on the server listed.
The connection string
To utilise the database within lawmaking, the connection string volition look like this, with the database name substituted for DB_NAME.
"Data Source=localhost;Initial Catalog=DB_NAME;User Id=sa; Countersign=someThingComplicated1234;" Some useful Docker commands
Some useful Docker commands can be found below
- View downloaded images:
docker images - View all containers:
docker container ls -a - View all running containers:
docker container ls -a - Commencement a container:
docker start CONTAINER_NAME - Stop a container:
docker stop CONTAINER_NAME - Remove a container:
docker rm CONTAINER_ID
Cross platform-ness
Although this tutorial focuses on using Microsoft SQL Server on macOS, at that place is no reason why you couldn't run your SQL Server case inside Docker on Windows or Linux.
If you accept any tips and tricks for cross-platform development with .Net Core, and so I would love to hear from you!
- Electronic mail: lporter@twilio.com
- Twitter: @LaylaCodesIt
- GitHub: layla-p
- Twitch: LaylaCodesIt
DOWNLOAD HERE
Posted by: howardsinglaid1992.blogspot.com

0 Komentar
Post a Comment