-
Notifications
You must be signed in to change notification settings - Fork 763
Open
Labels
Description
Hello,
Found a small issue with mssql-conf which I thought I'd let you know:
If the "sa" account has been renamed to something else via "ALTER LOGIN", then "mssql-conf set-sa-password" doesn't actually reset its password.
This is what I did in detail, in case I'm doing something wrong:
- Running in docker,
docker run -it --rm --entrypoint /bin/bash mcr.microsoft.com/mssql/server:2025-latest
. The same is reproducible with 2022, too. - Run /opt/mssql/bin/sqlservr once to setup with MSSQL_SA_PASSWORD="<password 1>"
- Via
/opt/mssql-tools18/bin/sqlcmd -S 127.0.0.1 -U sa -P '<password-1>' -C
:
ALTER LOGIN sa WITH name = superuser;
GO
exit
- Verify I can actually login as "superuser" :
/opt/mssql-tools18/bin/sqlcmd -S 127.0.0.1 -U sa -P '<password-1>' -C
- Stop the server, then do
MSSQL_SA_PASSWORD='<password-2>' /opt/mssql/bin/mssql-conf set-sa-password
<snip>
The system administrator password has been changed.
- Start the server again (
/opt/mssql/bin/sqlservr 2>&1 1>testme.log &
) - Try to login with the new password
mssql@8a233b783aba:/var/opt/mssql$ /opt/mssql-tools18/bin/sqlcmd -S 127.0.0.1 -U superuser -P '<password-2>' -C
Sqlcmd: Error: Microsoft ODBC Driver 18 for SQL Server : Login failed for user 'superuser'..
mssql@8a233b783aba:/var/opt/mssql$ /opt/mssql-tools18/bin/sqlcmd -S 127.0.0.1 -U superuser -P '<password-1>' -C
1> ^D