Как узнать пароль sa к sql server
Перейти к содержимому

Как узнать пароль sa к sql server

  • автор:

КАК узнать какой пароль на sa ?

«SQL state 28000
Native 18452
Message [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user ‘sa’.

«SQL state 28000
Native 18452
Message [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user ‘Ну тут мой логин!’.

Разберем по порядку.
1. Заходим в скуль(«Сервак») под пользователем «Юзер» с паролем «пшелнах».
2. Создаем базу «Хрень».
3. Проверяем аутентификацию в скуле — проверка силами скуля а не винды.
4. Лезем в 1С — «Администрирование|ПараметрыБазыСКЛ»
5. Заполняем Сервер — «Сервак», База данных — «Хрень», Пользователь — «Юзер», Пароль — «пшелнах».

How to Recover Lost SQL SA Password of SQL Server 2017/16/14/12

Read this article if you, unfortunately, forgot / lost SQL Server login account password (SA & User), or need to reset it. There are several scenarios where users Forgot MS SQL Server password or get locked out of SQL Server database. Moreover, they want to know how to connect to SQL Server when System Administrators are locked out. Let’s understand how to recover lost SQL SA password eaisly.

No worries, in this article we will describe the popular and efficient methods for you. But, before that, you have to know which password you forgot. Because you can use User or System Administrative login to connect with SQL Server Management Studio. After you figure it out, follow the article below that lets you know how to recover SQL password in SQL Server 2017 / 2016 / 2014 / 2012 / 2008 / 2008 R2 / 2005.

Recover SQL Password in 5 Quick Steps

  • Download Tool and Set-up on your system.
  • Now Upload the MDF files from the computer.
  • SelectAccount you forgot SQL password for.
  • Click the Reset Password button at the bottom.
  • Hit the Ok button to recover SQL password quickly.

All Methods to Recover Lost SA Password of SQL Account

In the following section, we will tell you how to proceed when you lost the SQL Server ‘SA’ or ‘User’ password. So, let’s get started and learn about each and every method in a detailed manner.

Approach #1: Automate the SQL Password Recovery Process

No matter how complex or lengthy password you forgot or lost, the SQL Server SA Password Recovery can recover it easily. It can effortlessly reset User as well as SA login account password on your Windows machine without the help of Management studio. Also, it is 100 % safe for SQL database password recovery.

It only requires the ‘master.mdf’ for the reset process. The MDF files are secured with highly encrypted passwords that cannot be easily decrypted. Due to this, software generates the alternate password instead of an actual one. With this new password, one can easily login to SSMS either from User or SA account. The free version of tool is also available which can be easily downloaded from this given link.

Above all, it is a beneficial utility for both the administrator and User associated with a firm where a single SQL database is provided to every individual and every user is assigned with a password. So, whenever they forgot or lost the credentials, they can easily reset with this utility. To use this software, there is no need for an administrative right. One can only need ‘master.mdf’ file and easily unlock lost password of SQL Server 2017 / 2016 / 2014 / 2012 / 2008 / 2008 R2 / 2005 / 2000.

How to Recover SQL Server Login Password Step by Step

Step-1. Set up the software on your system and open it.

Step-2. Upload the ‘master.mdf’ file by clicking on Browse button.

Step-3. After scanning, all the Login account names appear on the screen.

Step-4. Choose the account – User or SA whose password you want to recover by selecting its corresponding box. Then, click on Reset Password button.

Step-5. Afterward, set a new password under the Password Settings window.

Approach #2: How to Reset SA Password in SQL Server using CMD

There’s a manual way with which you can recover the password. For this, your Windows account should be a member of local administrator group. Else one cannot use the CMD method. Let’s see how to recover SQL account password via. command-line procedure.

Step-1. Open cmd as an administrator and run the following command:-

Osql -S SQL_Instance_Name -E

Step-2. Once the above command done, run this cmdlet in command prompt.

EXEC sp_password NULL, ‘New_Password’, ‘Login_Name’

Approach #3: How to Reset SQL Server Password Using SQL Server Management Studio

To use this method, you should have SQL Server administrative power. Afterward, one can use this method to unlock the database account.

Step-1. Launch the SQL Server Management Studio and Connect with it.

Step-2. Go to Object Explorer and expand the Security option first. Afterward, expand the Logins.

Step-3. Select the account whose password you want to change and perform right-click on it. Select Properties from the menu.

Step-4. Under the Login Properties window, change the password and confirm it. Then, click on OK.

The Final Say

There are lots of options to explore after you realize that you have no longer access to the database because you lost the SQL Server password. In the article above, you will learn about how to reset lost SA & User database password and unlock the account.

Here, we focus on how to recover SQL password after User or SA forgot or lost it. Depending upon in which condition you are standing, you could pick any of the above method.

Exclusive Offers & Deals, Grab it Now!

Kumar Raj has more than 14 plus years of expertise in migration technology. He likes to create, edit, and optimize web material on topics conversion of email data, and migration of email data. For the majority of the past ten years, he has been a devoted fan of the technology scene.

Recover sa password [closed]

Closed. This question is off-topic. It is not currently accepting answers.

Want to improve this question? Update the question so it's on-topic for Stack Overflow.

Closed 10 years ago .

I have a computer which was used by another employee.

SQL Server 2008 R2 was installed but I don’t know the ‘sa’ password.

When I try to alter the login, it gives below error.

Cannot alter the login ‘sa’, because it does not exist or you do not have permission.

When I try to restore a database, it gives a different permission error.

(When I enter the Security —> Logins —> sa —> Properties windows authentication is disabled.)

Can I change it?

P.S: Password is not «password» 🙂

Aaron Bertrand's user avatar

2 Answers 2

The best way is to simply reset the password by connecting with a domain/local admin (so you may need help from your system administrators), but this only works if SQL Server was set up to allow local admins (these are now left off the default admin group during setup).

If you can’t use this or other existing methods to recover / reset the SA password, some of which are explained here:

Then you could always backup your important databases, uninstall SQL Server, and install a fresh instance.

You can also search for less scrupulous ways to do it (e.g. there are password crackers that I am not enthusiastic about sharing).

As an aside, the login properties for sa would never say Windows Authentication. This is by design as this is a SQL Authentication account. This does not mean that Windows Authentication is disabled at the instance level (in fact it is not possible to do so), it just doesn’t apply for a SQL auth account.

I wrote a tip on using PSExec to connect to an instance using the NT AUTHORITY\SYSTEM account (which works < SQL Server 2012), and a follow-up that shows how to hack the SqlWriter service (which can work on more modern versions):

Забыт пароль на учетную запись SA

Всякое бывает и всякое не бывает, но лучше иметь проработку на будущее чтобы не метаться потом, с вопросом — А как? Так вот сейчас я разберу давно волновавший меня вопрос, что делать если на сервере базы данных MS SQL Server 2008 R2 который достался Мне в наследство от предыдущего системного администратора не оставил вообще никаких паролей для подключения в оснастку управления именуемую как SQL Management Studio. Конечно оно все работает до поры до времени, но вот это время всегда приходится на такой парадокс:

Все обычно падает в пятницу, а в понедельник, что не упало в пятницу.

Я же этого всячески избегаю и прорабатываю постоянно сценки и шаги по восстановлению и резервированию если что-то пойдет не так.

Что можно узнать из развернутого?

Start — Control Panel — Administrative Tools — Services, служба относящаяся к сервису MSSQL — SQL Server (MSSQLSERVER) при открытии ее свойств (Properties) и перехода на вкладку Log On работает от имени системной учетной записи. Это хорошо. Теперь в любое время когда у Вас запланированы регламентные работы делаем так, переопределяем запуск данной службы от имени учетной записи с правами (обязательно) администратора на этой системе, но сперва конечно же создаем пользователя:

Start — All Programs — Accessories — запускаем Command Prompt с правами администратора и создаем пользователи и даем ему права локального администратора:

C:\Windows\system32>net user ekzorchik 712mbddr@ /add

The command completed successfully.

C:\Windows\system32>net localgroup Administrators ekzorchik /add

The command completed successfully.

C:\Windows\system32>exit

Теперь во вкладке Log On свойств службы SQL Server меняем от имени кого будет происходить запуск службы как показано на представленном скриншоте ниже:

This account: .\ekzorchik

Confirm password: 712mbddr@

Изменяю запуск службы SQL Server на локальную учетную запись

Следом последует окно с текстом:

The account .\ekzorchik has been granted the Log On As a Service right.

The new logon name will not take effect until you stop and restart the service

По такому же принципу проделываем и для службы SQL Server Agent от имени кого запускать данную службу.

Ну все правильно изменения применятся когда служба будет остановлена, а после запущена.

C:\Windows\system32>net stop SQLSERVERAGENT

The SQL Server Agent (MSSQLSERVER) service is stopping..

The SQL Server Agent (MSSQLSERVER) service was stopped successfully.

C:\Windows\system32>net stop MSSQLSERVER

The SQL Server (MSSQLSERVER) service is stopping.

The SQL Server (MSSQLSERVER) service was stopped successfully.

C:\Windows\system32>net start SQLSERVERAGENT

The SQL Server Agent (MSSQLSERVER) service is starting.

The SQL Server Agent (MSSQLSERVER) service was started successfully.

Затем делаю Logoff, а потом Logon в систему под уже созданной локальной учетной записью ekzorchik. Открываю оснастку SQL Management Studio:

Start — All Programs — Microsoft SQL Server 2008 R2 — SQL Server Management Studio и авторизуюсь с использованием Windows Authentication

Пробую авторизоваться

Нажимаю Connect, но в ответ вместо успешно входа получаю ошибку:

Увы! Подключиться не удалось

Делаю вывод что не прокатит такой фокус, вспоминая что еще можно сделать, вот в Ubuntu как сбрасываю пароль на учетную запись суперпользователя root в mysql я захожу в однопользовательский режим, интересно а тут такое есть.

Возвращаю все как было, т. е. Запуск службы от имени системы

Чтение документации на официальном сайте Microsoft привело меня вот к таким вот действиям по сбросу пароля на учетную запись SA:

Запускаю оснастку SQL Server Configuration Manager:

Start — All Programs — Microsoft SQL Server 2008 R2 — Configuration Tools — SQL Server Configuration Manager, затем останавливаю сервис SQL Server (MSSQLSERVER)

Останавливаю службы SQL Server через конфигуратор управления настройками

После чего остановленного сервиса открываю через правый клик его свойства (Properties), тут переключаюсь на вкладку Advanced (Расширенные) и в строке:

Startup Parameters после: -dC:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\master.mdf;-eC:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\Log\ERRORLOG;-lC:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\mastlog.ldf

указываю ключ -mSQLCMD . В итоге должно получиться следующее:

Изменяю поведение запуска сервиса sql server

Теперь запускаю службу для применения настроек. Если по службам SQL в оснастке управления все хорошо, служба запустилась то переходим к следующему этапу.

Открываю консоль командной строки с правами администратора:

Start — All Programs — Accessories — запускаем Command Prompt с правами администратора

C:\Windows\system32>sqlcmd

1> create login recovery with password=’712mbddr@’

2> go

1> sp_addsrvrolemember ‘recovery’,’sysadmin’

2> go

1> quit

Снова останавливаю сервис SQL Server (MSSQLServer), запускаю свойства, перехожу на вкладку Advanced и убираю добавленный параметр в запуске и запускаю сервис снова.

Теперь пробую авторизоваться

Пробую авторизовать под новой учетной записью SQL

Нажимаю Connect

Аутентификация проходит успешно

Что теперь? А просто изменяем пароль sql учетной записи sa как и планировалось, а текущая останется на всякий случай:

(local) (SQL Server 10.50.1600 — recovery) — Security — Logins — выделяю учетную запись sa и через правый клик Properties ввожу новый пароль:

Confirm password: 712mbddr@@

И нажимаю OK. Разлогиниваюсь и проверяю что могу подключиться под учетной запись SQL:

File — Disconnect Object Explorer

File — Connect Object Explorer…

Изменив пароль на учетной запись sa также успешно авторизуюсь

Нажимаю Connect и вуаля все получилось, как и было задумано.

На заметку: Но все можно проделать и из командной строки:

C:\Windows\system32>net stop mssqlserver

The SQL Server (MSSQLSERVER) service is stopping.

The SQL Server (MSSQLSERVER) service was stopped successfully.

C:\Windows\system32>net start mssqlserver /mSQLCMD

The SQL Server (MSSQLSERVER) service is starting.

The SQL Server (MSSQLSERVER) service was started successfully.

C:\Windows\system32>sqlcmd

Теперь я еще больше знаю по SQL Server 2008 R2 на всякий непредвиденный случай, вдруг у нас в отделе кто-то возьмет и намеренно все поменяет не предупредив ни кого. Задача поставленная в самом начале данной заметки выполнена. На этом я прощаюсь, с уважением автор блога — Олло Александр aka ekzorchik.

Используйте прокси ((заблокировано роскомнадзором, используйте vpn или proxy)) при использовании Telegram клиента:

Поблагодари автора и новые статьи

будут появляться чаще 🙂

Карта МКБ: 4432 7300 0040 4626

Большое спасибо тем кто благодарит автора за практические заметки небольшими пожертвованиями. С уважением, Олло Александр aka ekzorchik.

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *