Uninstall SQL Server on Ubuntu System

There are scenarios where you want to uninstall the SQL Server vNext CTP1. This blog describes how to uninstall Microsoft SQL Server on Ubuntu system. It will completely remove Microsoft SQL Server along with repository, data directories,  and binary of the SQL Engine.

Note: During uninstall mssql-server package, it does not remove all the files for the package, binaries are removed but folder structures are maintained to retain some files like user database files. This decision has been made intentionally by Microsoft.

Uninstall SQL Server on Ubuntu

  • Connect to your Linux machine as root user

Syntax: sudo -i

  • Stop the SQL Server service on Linux

Syntax: systemctl stop mssql-server

  • Verify the status of SQL Server service on Linux

  • Uninstall the mssql-server package

Syntax: apt-get remove -y mssql-server

  • Remove the data directories

Syntaxrm -rf /var/opt/mssql

  • Remove the binary directories:

Syntaxrm -rf /opt/mssql

  • Remove the repository files: 

Syntax: rm /etc/apt/sources.list.d/mssql-server.list

  • Verify the the mssql-server package file details

Syntax: dpkg -L mssql-server

The package output shows just structure, it doesn’t contain files.

Hope, you find this post useful during uninstallation of SQL Server on Ubuntu system. In the next post, we will discuss how to uninstall SQL Server tool.

2 thoughts on “Uninstall SQL Server on Ubuntu System

  • Gabriel

    Very Good! Obrigado

    Reply
  • Animesh Dutta

    Cool !

    Reply

Leave a comment

Your email address will not be published. Required fields are marked *