SQL Server - Creating a new login account with “sy

2019-08-05 04:28发布

问题:

My sql database has 2 accounts.

1st account is sa

2nd account is user

Both account has sysadmin role enabled.

We have already forgotten password for sa

We only know password for user

Somehow someone remove sysadmin role for user.

Now I need an account with sysadmin role.

How can I achieve that?

I cannot change the password for sa as some websites might be using sa account to connect to the database.

So, my best solution is to create a new account with sysadmin role by any means necessary.

回答1:

[Was prodded privately to convert my comment to an answer.]

You need to enumerate the web sites that might be using sa and STOP THEM FROM DOING THAT. Then change the sa password as follows:

http://blogs.msdn.com/b/raulga/archive/2007/07/12/disaster-recovery-what-to-do-when-the-sa-account-password-is-lost-in-sql-server-2005.aspx

You need to be a sysadmin to create a sysadmin. So instead of finding a way around the issue, which only makes your security situation even worse than it already is, fix it now and take control of your instance.