SQL Server on Linux: How to Change SA password
https://msdnshared.blob.core.windows.net/media/2016/08/7827.NinjaAwardTinyBronze.png
Introduction
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 three times then SA account will be locked or someone wants to reset the password.
Solution
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 the 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:
You can access Linux mssql server using SSMS.You can change SA password using GUI.
Install new version of SSMS -->SSMS 17.4 is the latest version of SQL Server Management Studio.
- Connect Linux SQL server on Windows server using SSMS.
- Select the Security->Logins folder on the left side of your window; Right-click “sa” and choose properties;
- Change password and confirm with complexity.
This article participated in TechNet Guru Competition May 2017 Jump and won a Bronze Medal.