How to change sa password in SQL Server 2008 express?

后端 未结 5 1843
被撕碎了的回忆
被撕碎了的回忆 2020-12-23 14:20

I have installed SQL Server 2008 express and logging in through windows authentication, it doesn\'t allow me to do anything. How do i change \'sa\' password or gain full pri

5条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-23 14:22

    This is what worked for me:

    • Close all Sql Server referencing apps.
    • Open Services in Control Panel.
    • Find the "SQL Server (SQLEXPRESS)" entry and select properties.
    • Stop the service (all Sql Server services).
    • Enter "-m" at the Start parameters" fields.
    • Start the service (click on Start button on General Tab).
    • Open a Command Prompt (right click, Run as administrator if needed).
    • Enter the command:

      osql -S localhost\SQLEXPRESS -E

      (or change localhost to whatever your PC is called).

    • At the prompt type the following commands:

      CREATE LOGIN my_Login_here WITH PASSWORD = 'my_Password_here'

      go

      sp_addsrvrolemember 'my_Login_here', 'sysadmin'

      go

      quit

    • Stop the "SQL Server (SQLEXPRESS)" service.

    • Remove the "-m" from the Start parameters field (if still there).

    • Start the service.

    • In Management Studio, use the login and password you just created. This should give it admin permission.

提交回复
热议问题