The server principal 'username' already exists (Microsoft SQL Server, error: 15025) RRS feed

  • Question

  • SQL Management Studio

    SQL 2008 R2

    Create database

    Restor from backup

    Now I am trying to create login

    I get an error The server principal 'username' already exists (Microsoft SQL Server, error: 15025)

    I delete user from database and try to create user having same error

    Muhammad Mehdi

    Tuesday, June 18, 2013 1:33 AM


  • Hi Muhammed,

    Please go through the below steps,

    use master 
    drop login <yourloginname>
    create login <yourloginname> with password='yourpassword',<requiredoptions>

    for the various option available with create login pls refer :

    If the login is already there, you can try to fix the orphan users in DB instead of deleting the login.

     you can use

    alter user username with login=loginname

    please refer alter user syntax here


    You can make use of  sp_change_users_login which is deprecated to fix the orphan user issue after restoring Db from one server to another server.

    After fixing the orphan users issue your login in the new server will be able to connect to the restored DB with all the permissions as in the old server.

    But if you have already deleted the users in the DB, then you have to create the user for the login.


    Tuesday, June 18, 2013 8:43 AM

All replies