Question

The docs has instructions about how to remove SQL Server. However, this leaves certain packages behind. How can I remove all traces and uninstall SQL Server 2017?

Was it helpful?

Solution

These are actually very poor instructions on how to remove the Microsoft SQL Server.

SQL Server installs these associated packages.

mssql-server
mssql-server-fts
mssql-tools
msodbcsql
unixodbc-dev

Assuming you wish to totally remove SQL Server, you should

# Stop the service
systemctl stop mssql-server.service

sudo add-apt-repository --remove "$(curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list)"

# Remove those packages from the system.
sudo apt-get --purge remove mssql-server mssql-server-fts mssql-tools msodbcsql unixodbc-dev

# Delete the SQL Server repositories
sudo rm /etc/apt/sources.list.d/mssql-* /etc/apt/sources.list.d/msprod*

# Remove the Microsoft keys.
apt-key del "BC52 8686 B50D 79E3 39D3  721C EB3E 94AD BE12 29CF"

# Delete the Microsoft created directories
sudo rm -rf /var/opt/mssql/ /opt/{microsoft,mssql-tools,mssql}/ /usr/share/doc/{msodbcsql,mssql-server,mssql-tools}
Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top