The two ways to change SQL Server system admin
You can change a SQL Server system administrator (sysadmin) account in two ways: add a new sysadmin account while keeping the old one, or remove the old account and promote a different one. The method you choose depends on whether you need to keep the original account active, whether you're working with SQL Server on Windows or Linux, and what authentication method your server uses.
The fastest route is usually to add a new sysadmin account through SQL Server Management Studio (SSMS) if you have access to it. If you've lost access to all sysadmin accounts, you'll need to restart SQL Server in single-user mode and connect as the machine administrator, which is more involved but still straightforward.
Key Takeaways
- You can add a new sysadmin without removing the old one, or replace it entirely — the choice depends on your security needs and whether you want to keep the original account active.
- SQL Server Management Studio (SSMS) is the standard tool for changing sysadmin accounts if you already have sysadmin access.
- If you've lost all sysadmin access, restart SQL Server in single-user mode and connect as the local machine administrator to regain control.
- Windows authentication and SQL Server authentication require different steps, so confirm which one your server uses before you start.
- After you add or remove a sysadmin account, test the new account immediately to confirm it has the right permissions before you disable the old one.
Adding a new sysadmin account through SQL Server Management Studio
Open SQL Server Management Studio on a machine that can reach your SQL Server instance. Connect using an account that already has sysadmin permissions. In the Object Explorer panel on the left, expand the server name, then expand Security, then right-click on Logins and select New Login.
In the Login dialog, enter the account name. If you're using Windows authentication, type the domain and username in the format DOMAIN\username. If you're using SQL Server authentication, create a username and password here instead. Click the Server Roles page on the left side of the dialog.
On the Server Roles page, check the box next to sysadmin. Click OK. The new account now has full system administrator permissions. Test it immediately by disconnecting and reconnecting to SQL Server using the new account to confirm it works before you make any other changes.
Removing an old sysadmin account
Once you've confirmed the new sysadmin account works, you can remove the old one. In SQL Server Management Studio, expand Security and Logins, right-click the old account name, and select Delete. A confirmation dialog will appear — click OK.
Before you delete an account, make sure no running jobs, scheduled tasks, or SQL Server Agent jobs use that account. If a job runs under a deleted account, it will fail on the next scheduled run. Check the Job Activity Monitor in SQL Server Management Studio under SQL Server Agent to see which accounts are in use.
Regaining access when all sysadmin accounts are locked
If you've lost access to every sysadmin account, you can restart SQL Server in single-user mode and connect as the local machine administrator. Stop the SQL Server service first — open Services (services.msc on Windows), find your SQL Server instance, right-click it, and select Stop.
Open a command prompt as administrator. Navigate to the SQL Server Binn folder, typically at C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\MSSQL\Binn (the version number changes depending on your SQL Server release). Run this command: sqlservr.exe -m. The -m flag starts SQL Server in single-user mode.
Open a second command prompt as administrator and run sqlcmd -S (local). You'll now be connected as the local machine administrator with sysadmin rights. Run this command to add a new sysadmin account: CREATE LOGIN [DOMAIN\username] FROM WINDOWS; ALTER SERVER ROLE sysadmin ADD MEMBER [DOMAIN\username]; (replace DOMAIN\username with the actual account). Type GO and press Enter to execute the commands.
Close the sqlcmd window and stop SQL Server. Restart it normally through Services. You can now connect using the new account you created.
Changing sysadmin on SQL Server running on Linux
SQL Server on Linux doesn't use Windows authentication, so all accounts are SQL Server authentication accounts. Connect to your instance using sqlcmd from a Linux terminal: sqlcmd -S localhost -U sa -P YourPassword. Replace YourPassword with the current sa password.
Create a new sysadmin account with this command: CREATE LOGIN newadmin WITH PASSWORD = 'StrongPassword123'; ALTER SERVER ROLE sysadmin ADD MEMBER newadmin; GO. Test the new account by disconnecting and reconnecting with the new username and password.
To remove the old account, run: DROP LOGIN oldadminname; GO. On Linux, you cannot use single-user mode recovery the way you can on Windows, so protecting your sysadmin passwords is especially important.
What happens to databases and permissions when you change sysadmin
Changing the sysadmin account does not affect database ownership, user permissions, or any data. Sysadmin is a server-level role that grants permission to manage the entire SQL Server instance. Individual databases and their contents remain unchanged.
If a database is owned by the old sysadmin account, you may want to change the owner to the new sysadmin account to avoid complications later. In SQL Server Management Studio, right-click the database, select Properties, go to the Files page, and change the Owner field. This is optional but recommended for databases you plan to keep long-term.
Testing the new account before you remove the old one
Always test a new sysadmin account on a non-production server first if possible. Connect to SQL Server using the new account and confirm you can perform basic sysadmin tasks: create a test database, view server properties, and check SQL Server Agent jobs.
On production servers, test the new account from a different machine if you can, to confirm network access and authentication work correctly. Keep the old sysadmin account active for at least one week after you add the new one, in case you discover a problem. Once you're confident the new account works, you can remove the old one.
Frequently Asked Questions
Can I have more than one sysadmin account?
Yes. Most organizations maintain at least two sysadmin accounts — one for daily use and one for emergencies or backup access. You can add as many sysadmin accounts as you need. The important thing is to document which accounts exist and who has access to each one.
What's the difference between sysadmin and other server roles?
Sysadmin is the highest level of permission on a SQL Server instance. Other server roles like securityadmin, serveradmin, and setupadmin grant specific permissions for security, server configuration, or setup tasks, but only sysadmin can do everything. If you need to grant limited permissions, use a more specific role instead.
Do I need to restart SQL Server after changing sysadmin accounts?
No. Changes to sysadmin accounts take effect immediately. You do not need to restart the service. However, if you're using single-user mode recovery, you will need to stop and restart SQL Server to return to normal multi-user mode.
What if I accidentally delete the sa account?
The sa account is the built-in SQL Server administrator. If you delete it, restart SQL Server in single-user mode and recreate it using the sqlcmd command: CREATE LOGIN sa WITH PASSWORD = 'NewPassword'; ALTER SERVER ROLE sysadmin ADD MEMBER sa; GO. You cannot delete the sa account if it's the only sysadmin left, so SQL Server will prevent you from doing that.
Can I change a sysadmin account without using SQL Server Management Studio?
Yes. You can use Transact-SQL commands directly through sqlcmd or any query tool. The commands are: CREATE LOGIN [accountname] FROM WINDOWS; to create a Windows account, or CREATE LOGIN accountname WITH PASSWORD = 'password'; for SQL Server authentication. Then run ALTER SERVER ROLE sysadmin ADD MEMBER [accountname]; to grant sysadmin rights.