How do you reset the SA password?

后端 未结 4 934
醉酒成梦
醉酒成梦 2021-01-12 09:40

How on earth do you reset the sa password? I know how to go into the dialogs and reset a password. That\'s now what I\'m asking about. It runs a little deeper than just clic

相关标签:
4条回答
  • 2021-01-12 09:57

    people also can try to change password this way by the below SP

    EXEC sp_password NULL, 'yourpassword', 'sa'
    

    hope may help other. thanks

    0 讨论(0)
  • 2021-01-12 10:00

    You could use: Reset-DbaAdmin Powershell cmdlet from https://dbatools.io.

    This function allows administrators to regain access to local or remote SQL Servers by either resetting the sa password, adding sysadmin role to existing login, or adding a new login (SQL or Windows) and granting it sysadmin privileges.

    This is accomplished by stopping the SQL services or SQL Clustered Resource Group, then restarting SQL via the command-line using the /mReset-DbaAdmin paramter which starts the server in Single-User mode, and only allows this script to connect.

    Using Reset-DbaAdmin will restart your SQL Server.

    Reset-DbaAdmin -SqlServer sqlcluster
    
    0 讨论(0)
  • 2021-01-12 10:10

    This should help: start SQL Server in single-user mode. This will allow local administrators to connect as a sysadmin fixed server role. A detailed description of how to do this can be found here.

    0 讨论(0)
  • 2021-01-12 10:12

    The simplest method I've found so far is to run SQL Server Management Studio / SQL Express under the SYSTEM context with Sysinternals PSEXEC app. After installing (copying psexec.exe to your computer, running it and accepting the EULA), you can type the following to invoke a system-context instance:

    psexec -s -i <path to ssms.exe/sqlservr.exe>
    

    You can use the GUI and don't require single-user mode to effect changes. I had problems with an unknown client tying up the snigle-user connection and this saved me.

    0 讨论(0)
提交回复
热议问题