I recently had a domain account removed and later recreated. I got my old machine back but noticed I had lost access to SQL SERVER. I had originally installed SQL with my domain account, so that account was the only “sysadmin” in SQL. With that account having been deleted, I had lost control of SQL.
After some googling I found a solution that has given me control back. You have to run SQL in “single user mode” this option pretty much makes any “Local Admin” a “sysadmin” in SQL, than giving you the rights to add your new account as a sysadmin. Apparently previous versions of SQL would always allow “Local Admins” access, but that is not the case with the latest versions of SQL. Since I am currently running BizTalk 2009, it means I am using SQL Server 2008.
For more information: http://msdn.microsoft.com/en-us/library/ms188236(v=SQL.105).aspx
You will first have to stop all instances of SQL Server, plus the SQL Server Agent. So I just went ahead and stopped all SQL Related Services.
- Start | Microsoft SQL Server 2008 | Configuration Tools | SQL Server Configuration Manager
- Click on “SQL Server Services”
- Right Click and Stop all your services
Open two Command Consoles – I ran both as Administrator
- Change path to location of your SQL Installation
- Typically: C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\Binn
- Run the following command: sqlservr.exe –m
- Command window will show log of SQL Starting and Running…
- Switch over to your second Command Window
- Start the following Program: sqlcmd
Type the following if creating a Windows Account:
- CREATE LOGIN [Domain\User] FROM WINDOWS;
Otherwise if using a SQL Account type the following:
- CREATE LOGIN [LoginName] WITH PASSWORD = ‘SomePassword’;
Type the following:
- EXE sp_addsrvrolemember ‘LoginName’, ‘sysadmin’
After this I actually had to reboot before SQL would let me log in using my new Domain Account. Or as my screenshots show, my new “SQL Security” account.
Welcome to my blog!
I have been putting this off for a very long time now, mainly because really I don’t like to write much. But I seem to always be going back and trying to find out what I was previously thinking, or eventually how I figured something out. So here we are…
Hopefully these posts will jot my memory, and hopefully be useful for others out there.
My day-to-day job is mainly of being a BizTalker, that is working with Microsoft BizTalk Server. I have been working with BizTalk Server now for over 10 years originally starting with the BizTalk Jumpstart Kit back in 2000. We have sure come a long way since then… So i’ll have some posts about BizTalk…
I used to teach .NET Programming for almost 4 years so when trying to describe concepts I try to bring it down to an easy level, hopefully I will be able to do the same with these Blog entries. So i’ll have some posts about .NET concepts…
My Kids convinced me at the start of 2010 to buy an iMac, I was quite hesitant at the time because I have always been a Microsoft guy. And to tell you the truth I love it! Since then I have been trying to get stuff done on it. Macs are suppose to be easy to use, and apparently they are, if you haven’t been in IT for a long time and set in your ways on how to do something. So i’ll have some posts about using iMacs…
Since also getting this iMac I’ve gotten interested in iPhone/iPad Development, tried the Object C route, didn’t like it. So I have gone with my .NET experience and using MonoTouch. So i’ll have some posts about MonoTouch.
So expect to find a bit of everything on this blog so I hope you enjoy.
PS: I don’t know why I like “…” so much, but you’ll see it lots…
So I have previously been doing iPhone Development with Xcode 3.2.6 and it was time to try out Xcode 4.0.2. Well it was actually MonoTouch development, but that is not important for this post. Anyways I still need to keep the older version of Xcode around.
So I did some research on installing Xcode 3.2.6 “side-by-side” with Xcode 4.0.2. I came across a few different solutions, like install 4, then go back and reinstall 3, etc. I wanted to keep it as simple as possible, the suggestions I liked the most said to just rename your “Developer” folder to something else, and then install the new version of Xcode which will then default to and create a new “Developer” folder.
Sure enough, easy I told myself, I will just go into Finder and rename the folder. Well as I found out, this wasn’t such an easy task. My first issue on the iMac, I think everything can be done by Right-Clicking my mouse. Do I come from a Windows background or what?
Anyways as I found out, the “usual” way to rename a folder on your Mac is to Click on the File or Folder and then press the “return” key (Enter for those Windows users out there).
Except I soon found out, this wasn’t working with the “Developer” folder.
So how do you rename this folder, you use Terminal. This is like the “Command Prompt” of Windows on your Mac. Luckily I know enough basic Unix commands to get me around. You will find “Terminal” in Applications|Utilities or type “Terminal” in your Spotlight Search (Click on Top Right Magnifying Glass)
Once in Terminal, type the following command
sudo mv /Developer /Developer3.2.6
- mv – unix command for Move (There is no rename command)
- /Developer – Rename which folder
- /Developer3.2.6 – Rename to what? Name this whatever you want your new name to be
- sudo – this one got me, I originally tried without this command on the front and kept getting a permissions issue. This command sudo is for substituting users. I look at it as asking for elevated privileges. You will also be prompted for your Password. I assume (but haven’t verified) you have to be an administrator. But then again what developers aren’t