How to Stop, Start, Enable and Disable SQL Server Services on Linux

By:   |   Comments (1)   |   Related: > SQL Server on Linux


Problem

Microsoft has recently released SQL Server to run on Linux servers. Once installed, we may need to stop, start, enable or disable the services. In this tip we will see how to do it in Linux.

Solution

In the previous tip, Installing SQL Server vNext CTP1 on Red Hat Linux 7.2, we saw how to install SQL Server on Redhat Linux. Now let's explore how to perform operations for SQL Server services.

Check the status of SQL Server Services

Once we have SQL Server installed, we can check the service status using the below command.

#check the status of mssql-server service.

systemctl status mssql-server

SQL Server service status

We can see the service status is Active (Running) that means the SQL Service is running fine.

Stop the SQL Server Services

To stop the SQL Server services we need to run the below command.

#Stop mssql-server service.

sudo systemctl stop mssql-server

SQL Server service status

Once the services are stopped, we can check the status using the previous command.

SQL Server service status

We can now see that the service status has changed to Failed, since the SQL Server services are in a stopped status.

Start the SQL Server Services

To start SQL Server services we need to run the below command.

#Start mssql-server service.

sudo systemctl Start mssql-server

Start the SQL Server Services

Now check the status of SQL services and we can see it is running again.

SQL Server service status is active

Stop and Disable the SQL Server Services

To stop and disable the SQL Server services run the below commands.

#Stop and Disable mssql-server service.

sudo systemctl stop mssql-server

sudo systemctl disable mssql-server

Stop and Disable the SQL Server Services

Verify the status of SQL Server services.

Verify the SQL Server service status is stopped and disabled

Now the status of the service has changed to Disabled as highlighted above.

Enable and Start the SQL Server Services

To enable and start the SQL Server services run the below commands.

#Enable and start mssql-server service.

sudo systemctl enable mssql-server

sudo systemctl start mssql-server

Enable and Start the SQL Server Services

Again we can verify the status of SQL Server services.

Verify the SQL Server service status
Next Steps
  • Explore SQL Server on Linux and perform these operations for basic administration purpose.
  • Read more SQL Server on Linux Tips.


sql server categories

sql server webinars

subscribe to mssqltips

sql server tutorials

sql server white papers

next tip



About the author
MSSQLTips author Rajendra Gupta Rajendra Gupta is a Consultant DBA with 14+ years of extensive experience in database administration including large critical OLAP, OLTP, Reporting and SharePoint databases.

This author pledges the content of this article is based on professional experience and not AI generated.

View all my tips



Comments For This Article




Monday, October 23, 2017 - 9:31:58 PM - steven Back To Top (68711)

Do you know how to prevent SQL Server start up with computer starting up?















get free sql tips
agree to terms