Last update at :2024-01-29,Edit by888u
This morning when we remotely accessed the server, we found that we had forgotten the sa user password of the server SQLSERVER 2008 database. Unfortunately, we also forgot to enable the windows user login function. At that time, we felt that it was over, and there was still a lot of data in it. Fortunately, I found a solution in the end. I am afraid that I will encounter it again next time, so I plan to write it down.
1. Retrieve SQLSERVER password
- Key points of operation: Find a way to add an account with new permissions, you need to use sqlservr -m and sqlcmd
2. Operation steps
1. First enter the system service to stop the database service
2. Start in single-user mode. If you don’t know, search for sqlservr.exe in the installation directory to see which directory this file exists in. Then call it from the command line and add the -m parameter, that is, sqlservr -m< /p>
3. Log in to sqlserver. I personally like to use sqlcmd. Execute the command in CMD: sqlcmd and press Enter
4. At this time, the sqlcmd just opened comes in and operates as follows
C:\Users\Administrator>sqlcmd 1> create login anyang with password='admin@123' 2>go 1> sp_addsrvrolemember 'sqlbad','sysadmin' 2>go At this time, a database administrator account named anyang will be added to the system.5. End the sqlcmd and sqlservr -m windows, restart the SQLSERVER service, log in with "sqlbad", and the password is "admin@123" in the command line. At this time, you have successfully logged in to the database, and you can back up data, set permissions, etc. operate.
Recommended site searches: foreign domain name application, virtual host purchase for 0 yuan, domain name registration inquiry, US anti-attack server, domain name auction, domain name registration inquiry, free cn domain name registration, Guangdong website registration, icp website registration, free cloud server,
发表评论