MS SQL Setup: Difference between revisions
Jump to navigation
Jump to search
Created page with "=Set up= Get the image <syntaxhighlight lang="bash"> sudo docker pull mcr.microsoft.com/mssql/server:2019-latest # Run the container sudo docker run -e "ACCEPT_EULA=Y" -e "SA..." |
|||
Line 23: | Line 23: | ||
# Connect locally | # Connect locally | ||
sqlcmd -S <ip_address>,1433 -U SA -P "<YourNewStrong@Passw0rd>" | sqlcmd -S <ip_address>,1433 -U SA -P "<YourNewStrong@Passw0rd>" | ||
</syntaxhighlight> | |||
=Using= | |||
Find the container with | |||
<syntaxhighlight lang="bash"> | |||
docker ps -a | |||
docket start <container id> | |||
sudo docker exec -it sql1 "bash" | |||
/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P "<YourNewStrong@Passw0rd>" | |||
</syntaxhighlight> | </syntaxhighlight> |
Revision as of 01:42, 21 May 2021
Set up
Get the image
sudo docker pull mcr.microsoft.com/mssql/server:2019-latest
# Run the container
sudo docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=<YourStrong@Passw0rd>" \
-p 1433:1433 --name sql1 -h sql1 \
-d mcr.microsoft.com/mssql/server:2019-latest
# How to change password
sudo docker exec -it sql1 /opt/mssql-tools/bin/sqlcmd \
-S localhost -U SA -P "<YourStrong@Passw0rd>" \
-Q 'ALTER LOGIN SA WITH PASSWORD="<YourNewStrong@Passw0rd>"'
# Connect to container
sudo docker exec -it sql1 "bash"
# Log in container
/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P "<YourNewStrong@Passw0rd>"
# Connect locally
sqlcmd -S <ip_address>,1433 -U SA -P "<YourNewStrong@Passw0rd>"
Using
Find the container with
docker ps -a
docket start <container id>
sudo docker exec -it sql1 "bash"
/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P "<YourNewStrong@Passw0rd>"