Learn more about SQL Server tools

mssqltips logo
 

Tutorials          DBA          Dev          BI          Career          Categories          Webcasts          Whitepapers          Today's Tip          Join

Tutorials      DBA      Dev      BI      Categories      Webcasts

DBA    Dev    BI    Categories

 

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


By:   |   Last Updated: 2017-02-27   |   Comments (1)   |   Related Tips: More > 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.


Last Updated: 2017-02-27


next webcast button


next tip button



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

View all my tips
Related Resources





Post a comment or let the author know this tip helped.

All comments are reviewed, so stay on subject or we may delete your comment. Note: your email address is not published. Required fields are marked with an asterisk (*).

*Name    *Email    Email me updates 


Signup for our newsletter
 I agree by submitting my data to receive communications, account updates and/or special offers about SQL Server from MSSQLTips and/or its Sponsors. I have read the privacy statement and understand I may unsubscribe at any time.



    



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

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


Learn more about SQL Server tools