Articles in this section

Unable to import/export an SQL Server database or apply the changes for a database user in Plesk: User or role does not exist in this database

Plesk for Windows kb: technical

Applicable to:

  • Plesk for Windows

Symptoms

  • When importing/exporting a Microsoft SQL Server database dump, applying the settings for a database user or activating/deactivating a domain in Plesk,  the operation fails with the message:

    PLESK_ERROR: User or role 'db_user' does not exist in this database.
    ...

  • When changing the password of a database user in Plesk, the operation fails with the error message:

    PLESK_ERROR: Error: Connection to the database server has failed: Failed to update user permissions for jdoe: SQLSTATE[42000]: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]User or role 'jdoe' does not exist in this database.

  • A website cannot be opened with:

    PLESK_INFO: Server Error in '/' Application.
    The SELECT permission was denied on the object 'User', database 'db_example', schema 'dbo'.

    PLESK_INFO: Server Error in '/' Application.
    Cannot open database "db_example" requested by the login. The login failed.
    Login failed for user 'db_user'.

Cause

The website's database user is not mapped to the website database in SQL Server.

Resolution

  1. Connect to your Plesk server via RDP.
  2. Start SQL Server Management Studio (SSMS) at Windows Start > All Programs > Microsoft SQL Server Tools XX.

    Note: If SSMS is not installed, download it from the official Microsoft website and install.

  3. In SSMS, connect to the database server where the affected database user is located.
  4. Expand Security > Logins > right-click on the database user and open its Properties.

     

     

  5. Switch to the User Mapping tab.
  6. Find the user's database and check it under the Map column.

     

     

  7. Click on the database and enable the following role memberships:

    • db_datareader
    • db_datawriter
    • db_ddladmin
    • public

     

     

  8. Click OK.
Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.