In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you what to do when you forget the password of the SQL Server administrator. I hope you will gain a lot after reading this article. Let's discuss it together.
1. Log in to the SQL Server server using any member of the local Administrators group of the SQL Server server computer
two。 Identify the SQL Server service that forgot the administrator password
You can view it in the services.msc, or use the following Powershell command
Get-Service |? DisplayName-Like 'SQL Server (*)'
3. Stop the SQL Server service
4. Start the SQL Server service in single-user mode (/ m parameter)
Start with the parameter / m and execute at the administrator command prompt
Net start start mssqlserver / m
5. Use slqcmd to complete administrator unlocking
Starting SQL Server in single-user mode enables any member of the computer's local Administrators group to connect to the SQL Server instance as a member of the sysadmin fixed server role
6. When you are finished, stop the SQL Server service and start SQL Servr and related services in a normal manner.
Powershell generic script-add the current login account to the sysadmin member of SQL Server
# script needs to be executed in Powrshell at the administrator command prompt
# you can enter Powershell at the administrator command prompt by using the following command
# Powershell Start-Process Powershell.exe-Verb runas
Reportdb' # define the SQL Server service to operate ServiceName # stop the SQL Server service and start net.exe stopService.Name in single-user mode) net.exe startService.Name) / m # sysadmin member Service.Name-Split'$') [1] If (- Notuser = [Environment]:: UserDomainName +'\'+ [Environment]:: UserName user] FROM WINDOWS EXEC sp_addsrvrolemember [Instance-Q $sql # starts the SQL Server service normally (dependent services need to be manually checked to start) net.exe stopService.Name) net.exe startService.Name)
Other instructions
One way you can regain access is to reinstall SQL Server and attach all databases to the new instance. This solution is time-consuming, and you may also need to restore the master database from a backup to restore the login. If the backup of the master database is old, it may not contain all the information. If the backup of the master database is newer, it may have the same login name as the previous instance; therefore, the administrator will still be locked.
After reading this article, I believe you have a certain understanding of what to do when you forget the password of the SQL Server administrator. You want to know more about it. Welcome to follow the industry information channel. Thank you for your reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.