How to use QGIS User Profiles with Different PostgreSQL Users
QGIS uses the default profile when first installed. QGIS Profiles store a user’s bookmarks, any custom settings, models, scripts, and perhaps most importantly, the user’s connections and authentication database. The authentication database is protected using the QGIS Master Password. In an enterprise environment, QGIS Profiles are very helpful when testing user database access. One can set up a read-only role and associated login user, for example, and then be certain that such users have the correct access to database objects. The following steps detail how to create a new profile with your current database connection.
1. Export your current database connection(s) by right-clicking on PostgreSQL in the QGIS Browser Panel and selecting “Save Connections”. In the Manage Connection dialog box, select your database connection (or Select All) and click Export. Alternatively, you can set up the connection manually in the new profile, but this method saves a little time. It also eliminates the possibility of human error when re-entering a database connection information.

2. Create a new profile by clicking on the top menu in Settings > User Profiles > New Profile. A dialog box will appear asking you to name your new profile. Enter a name (e.g. Training Read-Only User). Click OK.

3. The new profile will open immediately. You can see which profile you are on by looking at the top of the QGIS window.

4. Load the database connection from the saved file by right-clicking on PostgreSQL in the Browser Panel and selecting Load Connections. Locate the saved database connections file you made in Step 1 and load the training database. Note that this does not restore the authentication record. You must create a new authentication record in the new profile.
5. To create the new authentication record, right-click on the database connection that was imported in the previous step and click on Edit the Connection. In the authentication section, click the GREEN PLUS icon to create a new authentication record. Make sure you use whatever credentials you are planning to test, such as a read-only user.
6. Once the authentication record is created, you should be able to connect to the database.
IMPORTANT: if your database user is not set up correctly with the proper permissions, you will get errors when trying to connect to the database. Sometimes these errors can be helpful, so read them carefully.
How can we help?
Contact us today to schedule a free consultation with a member of our team.