Bug 500445 - digiKam "You have insufficient privileges on database.
Summary: digiKam "You have insufficient privileges on database.
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Database-Multiusers (other bugs)
Version First Reported In: 8.1.0
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-02-20 03:20 UTC by David
Modified: 2025-02-23 10:26 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In: 8.6.0
Sentry Crash Report:


Attachments
Database configuration details (83.34 KB, image/jpeg)
2025-02-20 03:20 UTC, David
Details
phpMyAdmin shows proper privileges for database user "digikam" (118.73 KB, image/jpeg)
2025-02-20 03:24 UTC, David
Details
List of 28 tables that are in the database "digikam" and were created by the digiKam app on the first pass. (414.39 KB, image/jpeg)
2025-02-20 03:25 UTC, David
Details
Log file from DebugView when starting DigiKam - waited a minute and <Cancel> on the popup (14.92 KB, text/plain)
2025-02-20 18:56 UTC, David
Details
Log file after changing to IP address - did not help (16.85 KB, text/plain)
2025-02-20 19:09 UTC, David
Details

Note You need to log in before you can comment on or make changes to this bug.
Description David 2025-02-20 03:20:55 UTC
Created attachment 178621 [details]
Database configuration details

SUMMARY:
 I am getting an error message when I restart digiKam saying the MySQL database user "digikam" lacks the privilege to "CREATE TABLES". Everything worked the first time when it created all the tables and entries needed to catalog the 300k images (screenshots attached), so it seems it was okay at first, then something changed.

I'm trying to set up a system where multiple PC can access the same SMB shared NAS picture library. The NAS (WD PR4100 w/ 16GB RAM, 24TB usable) has a "built-in" MariaDB (v10.5.19-MariaDB) being used for the MySQL Server in the digiKam app.

This error message is popping up on both PCs that were fine when the logged in the 1st time and started to catalog images, so they are both now locked out.

And, most importantly, when I was testing this on a smaller scale, I didn't have to do anything to see if digiKam on a MySQL server with multiple PCs access the shared image library was possible. It just worked. Then I uninstalled digiKam on 2 PCs, dumped the database and started over from scratch.

STEPS TO REPRODUCE
1. Using a Remote MySQL server that is "built-in" on a WD PR4100 NAS (MariaDB v10.5.19-MariaDB) and phpMyAdmin to manage (3rd Party app installed on the NAS). 
Used phpMyAdmin to create a new user "digikam" and assigned a simple password (digikam) for that use. phpMyAdmin also created a database with the name "digikam" and assigned all the privileges for that user to own the database. At this point, the database is empty with no tables.
2. Install digiKam 8.1 on the Windows 10 PC, filled in all the details for the remote MySQL server and the local databases. 
Then create a new collection and start cataloging 300k images (see attached screenshots). 
At this point, all the tables get successfully created on the NAS's digikam database and over the course of 36 hours, the tables end up with enough entries for 300K-plus images.
3. After it finished, I closed digiKam. 
After that, digiKam will not start again. 
Every time I start digiKam, it fails to open with the error message popped up. The only option is to cancel, so I can't see if there is something fixable in another setting
4. According to phpMyAdmin, all the privileges are the same as when I started and nothing has changed.
The local databases are on a drive that still has 600GB free 
5. I completely uninstalled DigiKam from the PC and drop the NAS database digikam. 
I also disabled and re-enabled the NAS's "Network Shared Database" to get a fresh copy running and started over from scratch.
I tried this 2x with the same results.
6. I retyped the "Remote Server Settings" password to match the database server's digikam account, and that didn't help.

OBSERVED RESULT
Failure to open digiKam or reconnect to the remote MySQL database

EXPECTED RESULT
DigiKam should run normally and connect to the remote MySQL database

SOFTWARE/OS VERSIONS
Windows: 10 Pro (64bit X86), 22H2 (OS Build 19045.5487)
Western Digital PR4100 (16GB RAM / 24TB usable, OS5 5.30.103) using MariaDB 10.5.19-MariaDB - Source distribution).
DigiKam 8.1.0 for Windows.

ADDITIONAL INFORMATION
The NAS was updated with a new version of its OS5 on Feb 11. But the release notes do not have any mention of an update to the MariaDB version.
Comment 1 David 2025-02-20 03:24:08 UTC
Created attachment 178622 [details]
phpMyAdmin shows proper privileges for database user "digikam"
Comment 2 David 2025-02-20 03:25:39 UTC
Created attachment 178623 [details]
List of 28 tables that are in the database "digikam" and were created by the digiKam app on the first pass.
Comment 3 caulier.gilles 2025-02-20 04:21:49 UTC
Did you expect that all different computers access to the same database stored on the NAS ? If yes, it's not supported.

https://docs.digikam.org/en/setup_application/collections_settings.html#
Comment 4 Maik Qualmann 2025-02-20 07:01:04 UTC
Do you also use the '%' placeholder with digiKam? Then please use the IP address of the NAS. We have already seen strange effects here, depending on the network configuration.

Otherwise we need a DebugView log of the process, as described here for Windows:

https://www.digikam.org/contribute/#windows-host

Maik
Comment 5 David 2025-02-20 18:56:58 UTC
Created attachment 178658 [details]
Log file from DebugView when starting DigiKam - waited a minute and <Cancel> on the popup
Comment 6 David 2025-02-20 19:04:08 UTC
Comment on attachment 178658 [details]
Log file from DebugView when starting DigiKam - waited a minute and <Cancel> on the popup

[quote]Do you also use the '%' placeholder with digiKam? Then please use the IP address of the NAS. We have already seen strange effects here, depending on the network configuration.[/quote]
There was a % placeholder pre-loaded in one of the options when I installed DigiKam, but I can't double-check until I get past the failure to CREATE TABLES issues. Where should I look related to your question?
Comment 7 David 2025-02-20 19:09:17 UTC
Created attachment 178659 [details]
Log file after changing to IP address - did not help

Changed Remote Server Settings "Host Name" from its DNS short hostname to the IP address, but it still fails
Comment 8 David 2025-02-20 19:17:51 UTC
I noticed these lines about "No space left on device" in the DebugView log:
00000112	93.99256897	[19380] digikam.coredb: Core database: running schema update	
00000113	93.99736786	[19380] digikam.dbengine: Failure executing query:	
00000114	93.99736786	[19380]  "" 	
00000115	93.99736786	[19380] Error messages: "QMYSQL: Unable to execute query" "Error writing file './digikam/PrivCheck.frm' (Errcode: 28 \"No space left on device\")" "3" 2 	
00000116	93.99736786	[19380] Bound values:  QList()	
00000117	93.99742126	[19380] digikam.dbengine: Error while executing DBAction [ "CheckPriv_CREATE_TABLE" ] Statement [ "CREATE TABLE IF NOT EXISTS PrivCheck\n                    (id   INT,\n                    name VARCHAR(35))\n                    ENGINE InnoDB;\n                " ]	
00000118	93.99750519	[19380] digikam.coredb: Core database: error while creating a trigger. Details: QSqlError("3", "QMYSQL: Unable to execute query", "Error writing file './digikam/PrivCheck.frm' (Errcode: 28 \"No space left on device\")")	

At this point, the C:\ has 181GB free (1TB nVME), D:\ has 294GB (1TB SSD) free and the NAS has 10TB free.
Comment 9 Maik Qualmann 2025-02-20 19:34:00 UTC
The message is clear: there is no more free space in the area where the MySQL NAS server wants to write the file "PrivCheck.frm".

Error messages: "QMYSQL: Unable to execute query" "Error writing file './digikam/PrivCheck.frm' (Errcode: 28 \"No space left on device\")"

It is possible that the NAS segments the maximum MySQL storage per user and needs to be changed. This would not be unusual.

Maik
Comment 10 Maik Qualmann 2025-02-20 19:39:56 UTC
To explain, we always create a table (also a trigger) with the name "CheckPriv_CREATE_TABLE" at the start to check whether this works without problems and whether we have all the rights. This is then deleted again.
Your NAS server no longer has space to create this table.

Maik
Comment 11 David 2025-02-21 01:35:57 UTC
F'ing Western Digial and their NAS. So close. I thought I had the "Easy Button".
I'll open a case with them and find out if it's possible to expand.

Or, I need to find a good docker-compose entry for MariaDB and run it on my swarm (swarm of 2).
Comment 12 David 2025-02-23 01:47:14 UTC
[SOLVED]
The issue is resolved. It was caused by the disk being full, and the solution was to move the database to the RAID5 (with 10TB free).

Details:
By default, when the "Network Database" is enabled on the WD PR4100, it will use a small partition of one drive that is left over after a larger 4-drive RAID5 is created. 
The "solution" was to stop the MariaDB service (using the PR4100 AdminGUI and turning off the "Network Database"), then SSH into the PR4100 and look for the folder .@database@ on one of the 4 drives (/mnt/HD_(a,b,c,d)4). Then use mv (move) command to move that folder to the protected RAID5 mount (/mnt/HD/HD_a2). After that, make a link in the original location (EG: /mnt/HD_b4) to the new location (/mnt/HD/HD_a2/.@database@) and re-enable the "Network Database" option in the AdminGUI.

digiKam now starts with no warnings.

However, while the entire list of Albums is displayed, not all of them have picture previews. 
phpMyAdmin Status shows network traffic and what appears to be reads. And on digiKam it looks like it is rescanning the Collections (maybe to fill in the missing entries that got skipped when the database ran out of space the 1st time).
Comment 13 Maik Qualmann 2025-02-23 10:26:24 UTC
Thanks for the feedback and description.

Maik