Вопрос

I have a local install of SQLExpress that I haven't touched in months. Now I need to use it, and I've forgotten the SA password.
That would be fine, except that my local user which IS a member of the local Administrators Group apparently doesn't have permission to change the SA password or permissions to change my own User Rights.

I have tried using SQL Server Management Studio, I have done Single User Mode with SQL Server and used sqlcmd, they all tell me I don't have permissions for it.

I'm afraid that even reinstalling SQL Express isn't going to fix this for me. Does anyone know of any other route I could take here?

Это было полезно?

Решение

I would just uninstall and then reinstall -- it's not a very lengthy process. I believe you will be presented with the option to setup your sa account on the new installation.

Другие советы

As long as you have physical access to the machine, there's a way to start SQL Server in maintenance mode, which will allow you to connect and reset the password, assign new permissions, etc. Instructions.

Short version:

  1. From the Start menu, open SQL Configuration Manager.
  2. Go to the "SQL Server Services" node.
  3. Right-click on the SQL Server instance and select Properties.
  4. Under "Advanced", find the "Startup Parameters" setting, and prepend -m; (that is, add a hyphen, m, and semicolon to the beginning of the existing string).
  5. OK out.
  6. Stop and restart SQL Server.

You're now in maintenance mode, and can connect locally and change whatever settings you need to, including permissions. (The link says you can only connect with sqlcmd, but I know that, with SQL 2008, you can connect with SQL Server Management Studio.)

Make sure to take the server back out of maintenance mode (remove the -m;) when you're done, so that apps can connect normally.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top