Fix: Password Could Not be Changed in SQL

Reading time icon 3 min. read


Readers help support Windows Report. We may get a commission if you buy through our links. Tooltip Icon

Read our disclosure page to find out how can you help Windows Report sustain the editorial team Read more

how to fix sql password won't change

Those who utilize the Microsoft SQL Server database management system (typically within Windows Server) might sometimes need to change sa user passwords. Users can do that with the SQL Server Management Studio.

However, a Cannot alter the login `sa` error might arise when users try to change a sa password. As a result, users can’t change the passwords when that issue arises.

How can I fix the Cannot alter the login ‘sa’ error?

1. Log in as administrator

  1. Users usually can’t change the sa password because they don’t have sufficient admin permissions to do so. First, you’ll need to log out of Windows.
  2. Then log back into Windows with an admin account added to SQL Server.
  3. Launch the Microsoft SQL Server Management Studio software.
  4. Select Windows Authentication on the Authentication drop-down menu.SQL Server login window password could not be changed sql
  5. Press the Connect button.
  6. Click Security > Logins > sa on the left of the Server Management Studio window.
  7. Click Status on the Login Properties – sa window.
  8. Deselect the Login is locked out checkbox if selected.The Login is locked out option password could not be changed sql
  9. Then click the General tab on the window to reset the password.The General page password could not be changed sql

2. Modify the password with OSQL

  1. If you still can’t change a sa password, try changing the password with the OSQL SQL server tool. First, log in to your Windows virtual private server.
  2. Open the SQL Server Configuration Manager, which will usually be on the Start menu. However, you can also open it from its default WindowsSysWOW64 folder.SQL Server Configuration Manager password could not be changed sql
  3. Select SQL Server Services on the left of the window.
  4. Right-click SQL Server to select its Properties option.
  5. Select the Startup Parameters tab on the SQL Server window that opens.
  6. Then enter the following in startup parameter text box: -m;.
  7. Press the Add button, and select the OK option.
  8. A dialog box will then open. Click OK on that dialog box.
  9. Click OK on the SQL Server Properties window.
  10. Next, right-click SQL Server to select the Restart option.
  11. Open Run with the Windows key + R hotkey.
  12. Enter ‘cmd’ in Run’s text box, and press the Ctrl + Shift + Enter hotkey.Run accessory password could not be changed sql
  13. Then enter the query below in the Command Prompt. Replace the <SQL SERVER INSTANCE> with your SQL server name and <password> with your own password:
    osql -E -S .<SQL SERVER INSTANCE>
    exec sp_password @new='<password>’, @loginame=’sa’
    go
    alter login sa enable
    go
    exit
  14. Return to the SQL Server Configuration Manager window.
  15. Right-click SQL Server to select Properties again.
  16. Select –m; in the Existing parameters box on the Startup parameters tab.
  17. Press the Remove button.
  18. Click the Apply option, and press the OK button on the dialog box.
  19. Click OK to exit the properties window.
  20. Thereafter, you’ll need to restart the SQL server again. Right-click SQL Server on the Server Configuration Manager window to select Restart.
  21. Log in to SQL Server Management Studio with the new password you entered within the OSQL Command Prompt query.

Those are two ways you can fix the Cannot alter the login ‘sa’ error. First, try changing password with the Microsoft SQL Server Management Studio (as admin) and then OSQL.

If you have any other questions or suggestions, leave them in the comments section below and we’ll surely check them out.

RELATED ARTICLES TO CHECK OUT:

More about the topics: sql server, windows server