SQL Server on Linux: How to Change SA password

SQL Server on Linux: How to Change SA password

This article is about how to proceed when you get error message 'Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : Login failed for user 'sa'.. '

Problem Definition  

SA Password is entered wrong more than 3 times then SA account will locked or someone want reset password.


Using mssql-conf setup  need following step:- (this require reboot SQL Server)

1. Conf setup

you need to stop mssql-server  using this command   -conf setup command 

sudo systemctl stop mssql-server

sudo /opt/mssql/bin/mssql-conf setup

  • Setting up Microsoft SQL Server  
  • Enter the new SQL Server system administrator password:   --Enter strong password here  
  • Confirm the new SQL Server system administrator password: --Enter strong password here  
  • Starting Microsoft SQL Server...  
  • Enabling Microsoft SQL Server to run at boot...  
  • Setup completed successfully.
  • Check Mssql services status using command sudo systemctl status mssql-server

 2. Change password using sp_password 

  • Login with User who having sysadmin access on the server.
  •  syntax: sp_password NULL, ‘<insert_new_password_here>’, ’sa’ 
  • command :-

sp_password NULL, 'Mssql@12345', 'sa'

 3. Using GUI using Window server:-
   a. Connect Linux sql server in Windows server using SSMS.
   bSelect  the Security->Logins folder in the left side of your window; Right-click on “sa” and choose properties;

c.Change password  and confirm with complexity.


Back to Top