It was just a matter of time until I started combining my cloud experience with “different” flavours of SQL Server. I haven’t used Linux since my university days (Oracle – errgh) but recently some Friends of mine ( using LAMP stack ) asked me couple of questions about SQL Server Linux.
Not to bore you with that story I decided to spin up a virtual machine with SQL Server pre-installed on the Linux image, I used Red Hat, but as you know you can use:
- Red Hat Enterprise Linux 7.3, 7.4, 7.5, 7.6, or 8 Server
- SUSE Enterprise Linux Server v12 SP2, SP3, SP4, or SP5
- Ubuntu 16.04 LTS, 18.04 LTS
The point of this blog post is not a wizard style guide but if you go down this route, how do you actually login to SQL Server? I never had to do something like the below, then installing tools etc.
sudo curl -o /etc/yum.repos.d/mssql-server.repo https:// packages.microsoft.com/config/rhel/7/mssql-server-2019.repo
A section of the setup is the login for SA too. But with the pre-installed image extra work is needed.
Once the VM starts I personally use MobaXterm to SSH to it. I then run:
sudo systemctl status mssql-server
Great, you see the parent watchdog process and the second one actually running the SQL engine code.
Anyways, the virtual machine installs SQL Server with a random SA password. I needed to reset this before using SQLCMD commands.
sudo systemctl stop mssql-server sudo /opt/mssql/bin/mssql-conf set-sa-password
Then you can issue SQL commands. The good old classic, @@servername.