Bug 451153 - Incomplete Mariadb PrivCheck delete causes digiKam fail to start.
Summary: Incomplete Mariadb PrivCheck delete causes digiKam fail to start.
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Database-Mysql (show other bugs)
Version: 7.6.0
Platform: Mint (Ubuntu based) Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-03-05 05:40 UTC by bugskdeorg
Modified: 2023-10-20 21:14 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 8.2.0
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description bugskdeorg 2022-03-05 05:40:49 UTC
SUMMARY
***
NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***


STEPS TO REPRODUCE
1. Not completely sure since the state described below shouldn't have happened, I can only assume that the DROP TABLE in PrivCheck got into a bad state?
2. 
3. 

OBSERVED RESULT
Starting Digikam causes the error:
You have insufficient privileges on the database.
Following privileges are not assigned to you:
   CREATE TABLE
Check your privileges on the database and restart digikam.

EXPECTED RESULT
Program works fine

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: Linux Mint 20.3 Cinnamon
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
At some point Maria DB entered a state where .mysql.digikam/db_data/digikam contained a PrivCheck.idb file but no PrivCheck.frm file. Once Maria DB got into this state the PrivCheck table creation fails because it can't create a table under those circumstances. In the end the only fix I could find was to manually delete the PrivCheck.idb file from the file system.

I have no expertise with mariadb but the docs imply that it isn't possible to issue a CREATE TABLE and a DROP TABLE in the same transaction. But perhaps it would be possible to put in code that when PrivCheck fails, checks the table directory to see if this state has been entered and deletes the PrivCheck.idb file and tries again? Just a thought.
Comment 1 Maik Qualmann 2022-03-05 09:24:13 UTC
We have been deleting a possible existing PrivCheck table on startup for some time before testing the database. Since that time there have been no more problems. If this table deletion also fails because the database is defective, we will not delete any files within the database directly. An application must never delete files within the MySQL database.

Maik
Comment 2 bugskdeorg 2022-03-08 01:39:18 UTC
So the problem seems to be more complicated than I first thought. After I got digikam working again I tried to use facial recognition and that ended up running in about 1 second on 10s of 1000s of photos. Which obviously isn't right. After that digikam UX could no longer show me any pictures. I tried to restart and I'm back to:

You have insufficient privileges on the database.
Following privileges are not assigned to you:
   CREATE TABLE
Check your privileges on the database and restart digiKam.

I looked back in the digikam folder and there was PrivCheck.ibd all by itself again. So I manually deleted it.

When I restarted digikam this time I got a new error, same as above except instead of "CREATE TABLE" it says "ALTER TABLE' and now there are both a PrivCheck.frm and PrivCheck.ibd files present.

Since both files are present I decided to try and delete them through MariaDB instead of the file system. So I:
mysql -u root -p -S mysql.socket (executed inside of ~/.local/share/digikam/db_misc)

I have done this in the past using the password I set in digikam but after this latest round of problems this has stopped working. It now gives me a "ERROR 2002 (HY000): Can't connect to local MySQL server through socket 'mysql.socket' (111)" error.”

This looks like a password error but what is weird is that I had this working before. I have no idea why it’s rejecting the password now.

So I tried starting digiKam again as part of the startup process it did delete PrivCheck.frm but not PrivCheck.ibd and so I’m back where I started. 

And yes this time I get the CREATE TABLE error. And if I delete PrivCheck.ibd then yes I go back to the start with PrivCheck.frm and PrivCheck.ibd and the ALTER TABLE error.

So now I’m stuck. I can’t get to my photo database at all. Help!
Comment 3 Maik Qualmann 2022-03-08 06:55:14 UTC
If the database rights check reports an error, you do not have the appropriate rights. The tables would be automatically deleted at the next start if the rights were correct. Nothing must and should not be deleted by hand here. There is no password in the internal MySQL database, it is empty.
What are Ubuntu packages? Does it mean you are using digiKam's snap package? Snap uses a sandbox and these packages from Ubuntu are useless to use digiKam. Download our AppImage and give it a try.

Maik
Comment 4 bugskdeorg 2022-03-10 00:09:32 UTC
(In reply to Maik Qualmann from comment #3)
> If the database rights check reports an error, you do not have the
> appropriate rights. The tables would be automatically deleted at the next
> start if the rights were correct. Nothing must and should not be deleted by
> hand here. There is no password in the internal MySQL database, it is empty.
> What are Ubuntu packages? Does it mean you are using digiKam's snap package?
> Snap uses a sandbox and these packages from Ubuntu are useless to use
> digiKam. Download our AppImage and give it a try.
> 
> Maik

I'm using AppImage (digiKam-7.6.0-x86-64) with MariaDB. When I set up MariaDB digiKam asked me to set up a password and I saved that password. When I look in ~/.config/digitkamrc inside the Database Settings section it has a Database Encrypted Password value set.

When I was looking around I found a mysql.err file that contains entries from today. Apparently MariaDB crashed. It said to look at: https://mariadb.com/kb/en/library/innodb-recovery-modes/.

I got innodb_force_recovery=1 in /etc/my.cnf and restarted MariaDB with systemctl restart mariadb. But this doesn't seem to have fixed anything. I even tried 2 and that didn't work.

So at this point I've given up hope. I'm going to try to restore a backup but I suspect I'll have to tear everything down and start over again.

The real question I care about is - what happened to cause the corruption in the first place? I have never touched any of the DBs directly. I just use digiKam.
Comment 5 Maik Qualmann 2022-03-10 07:47:02 UTC
Enable Qt debug output:

export QT_LOGGING_RULES="digikam.*=true"

Start the AppImage in the terminal and post the log.

Maik
Comment 6 Maik Qualmann 2022-03-20 07:36:21 UTC
Is there any news, could the debug log be created?

Maik
Comment 7 bugskdeorg 2022-03-20 15:32:49 UTC
Here is the log I generated, please let me know what other information I can provide. I'd really like to understand why the database stopped working.
   Thanks! 
           Yaron

yaron@yaron-MS-7B79:~/Applications$ export QT_LOGGING_RULES="digikam.*=true" 
yaron@yaron-MS-7B79:~/Applications$ ./digiKam-7.6.0-x86-64_69f78304eb7f5b3b4c99798ce9ed747c.appimage 
qt5ct: using qt5ct plugin
-- digiKam Linux AppImage Bundle
-- Use 'help' as CLI argument to know all available options for digiKam application.
-- Notes: to integrate this bundle to your desktop, use AppImageLauncher.
--        to enable all debug messages on the console, use 'export QT_LOGGING_RULES="digikam*=true"'.
Check library libudev.so.0
Check library libxcb-dri3.so.0
Check library libcrypto.so.1.1
Check library libssl.so.1.1
Check library libnss3.so
Check library libnssutil3.so
Check library libsmime3.so
-- Preloading shared libs: :/usr/lib/x86_64-linux-gnu/libxcb-dri3.so.0:/usr/lib/x86_64-linux-gnu/libcrypto.so.1.1:/usr/lib/x86_64-linux-gnu/libssl.so.1.1:/usr/lib/x86_64-linux-gnu/libnss3.so:/usr/lib/x86_64-linux-gnu/libnssutil3.so:/usr/lib/x86_64-linux-gnu/libsmime3.so
Digikam::DXmlGuiWindow::setupIconTheme: Breeze icons resource file found
Digikam::DXmlGuiWindow::setupIconTheme: Breeze-dark icons resource file found
Digikam::unloadQtTranslationFiles: Qt standard translations removed: 0
Digikam::loadStdQtTranslationFiles: Qt standard translations path: "/tmp/.mount_digiKaieuQb5/usr/share/digikam/translations"
Digikam::loadStdQtTranslationFiles: Loaded Qt standard translations "en_US" from catalog "qt"
Digikam::loadStdQtTranslationFiles: Loaded Qt standard translations "en_US" from catalog "qtbase"
Digikam::loadStdQtTranslationFiles: Loaded Qt standard translations "en_US" from catalog "qt_help"
Digikam::loadStdQtTranslationFiles: Loaded Qt standard translations "en_US" from catalog "qtdeclarative"
Digikam::loadStdQtTranslationFiles: Loaded Qt standard translations "en_US" from catalog "qtquickcontrols"
Digikam::loadStdQtTranslationFiles: Loaded Qt standard translations "en_US" from catalog "qtquickcontrols2"
Digikam::loadStdQtTranslationFiles: Loaded Qt standard translations "en_US" from catalog "qtmultimedia"
Digikam::loadStdQtTranslationFiles: Loaded Qt standard translations "en_US" from catalog "qtwebengine"
Digikam::loadStdQtTranslationFiles: Loaded Qt standard translations "en_US" from catalog "qtxmlpatterns"
Digikam::AlbumWatch::AlbumWatch: AlbumWatch is disabled
Digikam::AlbumManager::setDatabase: Database Parameters:
   Type:                      "QMYSQL"
   DB Core Name:              "digikam"
   DB Thumbs Name:            "digikam"
   DB Face Name:              "digikam"
   DB Similarity Name:        "digikam"
   Connect Options:           "UNIX_SOCKET=/home/yaron/.local/share/digikam/db_misc/mysql.socket"
   Host Name:                 ""
   Host port:                 -1
   Internal Server:           true
   Internal Server Path:      "/home/yaron/Pictures"
   Internal Server Admin Cmd: "mysqladmin"
   Internal Server Serv Cmd:  "mysqld"
   Internal Server Init Cmd:  "mysql_install_db"
   Username:                  "root"
   Password:                  ""

Digikam::DatabaseServer::DatabaseServer: Database Parameters:
   Type:                      "QMYSQL"
   DB Core Name:              "digikam"
   DB Thumbs Name:            "digikam"
   DB Face Name:              "digikam"
   DB Similarity Name:        "digikam"
   Connect Options:           "UNIX_SOCKET=/home/yaron/.local/share/digikam/db_misc/mysql.socket"
   Host Name:                 ""
   Host port:                 -1
   Internal Server:           true
   Internal Server Path:      "/home/yaron/Pictures"
   Internal Server Admin Cmd: "mysqladmin"
   Internal Server Serv Cmd:  "mysqld"
   Internal Server Init Cmd:  "mysql_install_db"
   Username:                  "root"
   Password:                  ""

Digikam::DatabaseServer::DatabaseServer: Internal Server data path: "/home/yaron/Pictures/.mysql.digikam/db_data"
Digikam::DatabaseServer::initMysqlConfig: The mysql configuration was already up-to-date: "/home/yaron/.local/share/digikam/mysql.conf"
Digikam::adjustedEnvironmentForAppImage: Adjusting environment variables for AppImage bundle
Digikam::DatabaseServer::startMysqlServer: Database server: "mysqld" ("--defaults-file=/home/yaron/.local/share/digikam/mysql.conf", "--datadir=/home/yaron/Pictures/.mysql.digikam/db_data", "--socket=/home/yaron/.local/share/digikam/db_misc/mysql.socket")
Digikam::DatabaseServerStarter::startServerManagerProcess: Internal database server started
Digikam::DatabaseServer::run: Running 0 seconds...
Digikam::DbEngineConfigSettingsLoader::readConfig: Loading SQL code from config file "/tmp/.mount_digiKaieuQb5/usr/share/digikam/database/dbconfig.xml"
Digikam::DbEngineConfigSettingsLoader::readConfig: Checking XML version ID => expected:  3  found:  3
Digikam::CoreDbSchemaUpdater::update: Core database: running schema update
Digikam::BdEngineBackendPrivate::debugOutputFailedQuery: Failure executing query:
 "" 
Error messages: "QMYSQL: Unable to execute query" "Tablespace for table '`digikam`.`PrivCheck`' exists. Please DISCARD the tablespace before IMPORT" "1813" 2 
Bound values:  ()
Digikam::BdEngineBackend::execDBAction: 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                " ]
Digikam::CoreDbPrivilegesChecker::checkPriv: Core database: error while creating a trigger. Details: QSqlError("1813", "QMYSQL: Unable to execute query", "Tablespace for table '`digikam`.`PrivCheck`' exists. Please DISCARD the tablespace before IMPORT")
Digikam::CoreDbSchemaUpdater::startUpdates: Core database: insufficient rights on database.
Digikam::CoreDbAccess::checkReadyForUse: Core database: cannot process schema initialization
Digikam::KMemoryInfo::update: KMemoryInfo: Platform identified :  "LINUX"
Digikam::KMemoryInfo::bytes: KMemoryInfo: TotalRam:  16796749824
Digikam::LoadingCache::setCacheSize: Allowing a cache size of 400 MB
Digikam::adjustedEnvironmentForAppImage: Adjusting environment variables for AppImage bundle
Digikam::DatabaseServer::run: Running 30 seconds...
Digikam::DatabaseServer::run: Shutting down database server
Digikam::DatabaseServerStarter::stopServerManagerProcess: Internal database server stopped
unknown: QThreadStorage: Thread 0x7f6badec6bc0 exited after QThreadStorage 11 destroyed
Comment 8 Maik Qualmann 2022-03-20 15:45:41 UTC
However this problem came about, here is a pretty good solution:

https://itecnote.com/tecnote/mysql-error-tablespace-for-table-xxx-exists-please-discard-the-tablespace-before-import/

Look for an *.idb file that doesn't have a *.frm and move/delete it.

/home/yaron/Pictures/.mysql.digikam/db_data/digikam

Maik
Comment 9 bugskdeorg 2022-03-20 16:45:12 UTC
That would be privcheck.idb. I deleted it and ran again:

yaron@yaron-MS-7B79:~/Applications$ export QT_LOGGING_RULES="digikam.*=true"
yaron@yaron-MS-7B79:~/Applications$ ./digiKam-7.6.0-x86-64_69f78304eb7f5b3b4c99798ce9ed747c.appimage 
qt5ct: using qt5ct plugin
-- digiKam Linux AppImage Bundle
-- Use 'help' as CLI argument to know all available options for digiKam application.
-- Notes: to integrate this bundle to your desktop, use AppImageLauncher.
--        to enable all debug messages on the console, use 'export QT_LOGGING_RULES="digikam*=true"'.
Check library libudev.so.0
Check library libxcb-dri3.so.0
Check library libcrypto.so.1.1
Check library libssl.so.1.1
Check library libnss3.so
Check library libnssutil3.so
Check library libsmime3.so
-- Preloading shared libs: :/usr/lib/x86_64-linux-gnu/libxcb-dri3.so.0:/usr/lib/x86_64-linux-gnu/libcrypto.so.1.1:/usr/lib/x86_64-linux-gnu/libssl.so.1.1:/usr/lib/x86_64-linux-gnu/libnss3.so:/usr/lib/x86_64-linux-gnu/libnssutil3.so:/usr/lib/x86_64-linux-gnu/libsmime3.so
Digikam::DXmlGuiWindow::setupIconTheme: Breeze icons resource file found
Digikam::DXmlGuiWindow::setupIconTheme: Breeze-dark icons resource file found
Digikam::unloadQtTranslationFiles: Qt standard translations removed: 0
Digikam::loadStdQtTranslationFiles: Qt standard translations path: "/tmp/.mount_digiKaW1sTDC/usr/share/digikam/translations"
Digikam::loadStdQtTranslationFiles: Loaded Qt standard translations "en_US" from catalog "qt"
Digikam::loadStdQtTranslationFiles: Loaded Qt standard translations "en_US" from catalog "qtbase"
Digikam::loadStdQtTranslationFiles: Loaded Qt standard translations "en_US" from catalog "qt_help"
Digikam::loadStdQtTranslationFiles: Loaded Qt standard translations "en_US" from catalog "qtdeclarative"
Digikam::loadStdQtTranslationFiles: Loaded Qt standard translations "en_US" from catalog "qtquickcontrols"
Digikam::loadStdQtTranslationFiles: Loaded Qt standard translations "en_US" from catalog "qtquickcontrols2"
Digikam::loadStdQtTranslationFiles: Loaded Qt standard translations "en_US" from catalog "qtmultimedia"
Digikam::loadStdQtTranslationFiles: Loaded Qt standard translations "en_US" from catalog "qtwebengine"
Digikam::loadStdQtTranslationFiles: Loaded Qt standard translations "en_US" from catalog "qtxmlpatterns"
Digikam::AlbumWatch::AlbumWatch: AlbumWatch is disabled
Digikam::AlbumManager::setDatabase: Database Parameters:
   Type:                      "QMYSQL"
   DB Core Name:              "digikam"
   DB Thumbs Name:            "digikam"
   DB Face Name:              "digikam"
   DB Similarity Name:        "digikam"
   Connect Options:           "UNIX_SOCKET=/home/yaron/.local/share/digikam/db_misc/mysql.socket"
   Host Name:                 ""
   Host port:                 -1
   Internal Server:           true
   Internal Server Path:      "/home/yaron/Pictures"
   Internal Server Admin Cmd: "mysqladmin"
   Internal Server Serv Cmd:  "mysqld"
   Internal Server Init Cmd:  "mysql_install_db"
   Username:                  "root"
   Password:                  ""

Digikam::DatabaseServer::DatabaseServer: Database Parameters:
   Type:                      "QMYSQL"
   DB Core Name:              "digikam"
   DB Thumbs Name:            "digikam"
   DB Face Name:              "digikam"
   DB Similarity Name:        "digikam"
   Connect Options:           "UNIX_SOCKET=/home/yaron/.local/share/digikam/db_misc/mysql.socket"
   Host Name:                 ""
   Host port:                 -1
   Internal Server:           true
   Internal Server Path:      "/home/yaron/Pictures"
   Internal Server Admin Cmd: "mysqladmin"
   Internal Server Serv Cmd:  "mysqld"
   Internal Server Init Cmd:  "mysql_install_db"
   Username:                  "root"
   Password:                  ""

Digikam::DatabaseServer::DatabaseServer: Internal Server data path: "/home/yaron/Pictures/.mysql.digikam/db_data"
Digikam::DatabaseServer::initMysqlConfig: The mysql configuration was already up-to-date: "/home/yaron/.local/share/digikam/mysql.conf"
Digikam::adjustedEnvironmentForAppImage: Adjusting environment variables for AppImage bundle
Digikam::DatabaseServer::startMysqlServer: Database server: "mysqld" ("--defaults-file=/home/yaron/.local/share/digikam/mysql.conf", "--datadir=/home/yaron/Pictures/.mysql.digikam/db_data", "--socket=/home/yaron/.local/share/digikam/db_misc/mysql.socket")
Digikam::DatabaseServerStarter::startServerManagerProcess: Internal database server started
Digikam::DatabaseServer::run: Running 0 seconds...
Digikam::DbEngineConfigSettingsLoader::readConfig: Loading SQL code from config file "/tmp/.mount_digiKaW1sTDC/usr/share/digikam/database/dbconfig.xml"
Digikam::DbEngineConfigSettingsLoader::readConfig: Checking XML version ID => expected:  3  found:  3
Digikam::CoreDbSchemaUpdater::update: Core database: running schema update
Digikam::BdEngineBackendPrivate::debugOutputFailedQuery: Failure executing query:
 "" 
Error messages: "QMYSQL: Unable to execute query" "Lost connection to MySQL server during query" "2013" 2 
Bound values:  ()
Digikam::BdEngineBackend::execDBAction: Error while executing DBAction [ "CheckPriv_ALTER_TABLE" ] Statement [ "\n                    ALTER TABLE PrivCheck DROP COLUMN name;\n                " ]
Digikam::CoreDbPrivilegesChecker::checkPriv: Core database: error while creating a trigger. Details: QSqlError("2013", "QMYSQL: Unable to execute query", "Lost connection to MySQL server during query")
Digikam::CoreDbSchemaUpdater::startUpdates: Core database: insufficient rights on database.
Digikam::CoreDbAccess::checkReadyForUse: Core database: cannot process schema initialization
Digikam::KMemoryInfo::update: KMemoryInfo: Platform identified :  "LINUX"
Digikam::KMemoryInfo::bytes: KMemoryInfo: TotalRam:  16796749824
Digikam::LoadingCache::setCacheSize: Allowing a cache size of 400 MB
Digikam::adjustedEnvironmentForAppImage: Adjusting environment variables for AppImage bundle
Digikam::DatabaseServer::run: Shutting down database server
Digikam::DatabaseServerStarter::stopServerManagerProcess: Internal database server stopped
Comment 10 Maik Qualmann 2022-03-20 16:54:09 UTC
Hmm, I'm lost at the error message too. The database may be corrupt and you need to start over with a new one.
Which MySQL/MariaDB version are you using exactly?

Maik
Comment 11 bugskdeorg 2022-03-20 16:56:16 UTC
yaron@yaron-MS-7B79:~/Applications$ mariadb --version
mariadb  Ver 15.1 Distrib 10.3.34-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

I think the key question is - why did the DB get corrupt in the first place? Is this something I should expect is just going to happen? In which case don't I need to make sure to configure Digikam so that it always outputs everything to sidecar files just in case?
Comment 12 Maik Qualmann 2022-03-20 18:12:02 UTC
One could only guess what the cause is. digiKam crash, bug in MariaDB (there are bug entries for 10.3 for corrupted tables as well). A disk problem can also be the cause.
Depending on how familiar you are with databases, you can start digiKam and leave standing the error. Connect to the database on another terminal and see if it works.

mysql -u root -p --socket=/home/yaron/.local/share/digikam/db_misc/mysql.socket

Maik
Comment 13 bugskdeorg 2022-03-20 18:26:28 UTC
It asks me for a password, I tried empty and I tried the one I set when I setup digikam and neither works. What's the easiest way to just blow away the entire database and start fresh?
Comment 14 Maik Qualmann 2022-03-20 18:46:24 UTC
There is no password, just press enter or omit the -p option. Are you still being asked for a password? 

Maik
Comment 15 bugskdeorg 2022-03-23 04:34:56 UTC
yaron@yaron-MS-7B79:~/Pictures/.mysql.digikam/db_data/digikam$ mysql -u root --socket=/home/yaron/.local/share/digikam/db_misc/mysql.socket
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/home/yaron/.local/share/digikam/db_misc/mysql.socket' (111)

Good news, omitting -p means no password is asked for.
Bad news is that I'm still getting an error.
Comment 16 Maik Qualmann 2022-03-23 11:41:08 UTC
The message actually says that no database server is running. You have to leave digiKam with the error window open, otherwise the internal server will be shut down again. Otherwise start a MySQL server manually with the following command:

/sbin/mysqld --defaults-file=/home/yaron/.local/share/digikam/mysql.conf --datadir=/home/yaron/Pictures/.mysql.digikam/db_data --socket=/home/yaron/.local/share/digikam/db_misc/mysql.socket

Maik
Comment 17 bugskdeorg 2022-03-27 17:07:21 UTC
(In reply to Maik Qualmann from comment #16)
> The message actually says that no database server is running. You have to
> leave digiKam with the error window open, otherwise the internal server will
> be shut down again. Otherwise start a MySQL server manually with the
> following command:
> 
> /sbin/mysqld --defaults-file=/home/yaron/.local/share/digikam/mysql.conf
> --datadir=/home/yaron/Pictures/.mysql.digikam/db_data
> --socket=/home/yaron/.local/share/digikam/db_misc/mysql.socket
> 
> Maik

Gotcha, o.k. so I left Digikam running and this happened:
yaron@yaron-MS-7B79:~/Downloads$ mysql -u root -p --socket=/home/yaron/.local/share/digikam/db_misc/mysql.socket
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 13
Server version: 10.3.34-MariaDB-0ubuntu0.20.04.1-log Ubuntu 20.04

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> 

I tried SHOW TABLES FROM digikam; and got a nice big list of tables.

So now what? Do I try to dump and restore?
Comment 18 Maik Qualmann 2022-03-29 06:07:16 UTC
Try running the following commands in the database (mysql) if it works normally:

USE digikam;
CREATE TABLE IF NOT EXISTS PrivCheck (id INT) ENGINE InnoDB;
DROP TABLE PrivCheck;

Maik
Comment 19 bugskdeorg 2022-04-03 21:33:45 UTC
(In reply to Maik Qualmann from comment #18)
> Try running the following commands in the database (mysql) if it works
> normally:
> 
> USE digikam;
> CREATE TABLE IF NOT EXISTS PrivCheck (id INT) ENGINE InnoDB;
> DROP TABLE PrivCheck;
> 
> Maik

MariaDB [(none)]> USE digikam;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MariaDB [digikam]> CREATE TABLE IF NOT EXISTS PrivCheck (id INT) ENGINE InnoDB;
ERROR 1813 (HY000): Tablespace for table '`digikam`.`PrivCheck`' exists. Please DISCARD the tablespace before IMPORT
MariaDB [digikam]> DROP TABLE PrivCheck;
ERROR 1051 (42S02): Unknown table 'digikam.PrivCheck'
MariaDB [digikam]> 

So I tried:
MariaDB [digikam]> ALTER TABLE PrivCheck DISCARD TABLESPACE;
ERROR 1146 (42S02): Table 'digikam.PrivCheck' doesn't exist
MariaDB [digikam]> CREATE TABLE IF NOT EXISTS PrivCheck (id INT) ENGINE InnoDB;
ERROR 1813 (HY000): Tablespace for table '`digikam`.`PrivCheck`' exists. Please DISCARD the tablespace before IMPORT

But that didn't seem to do anything either.

Thoughts?
Comment 20 Maik Qualmann 2022-04-04 17:59:24 UTC
The database is broken. The normal process would be to create a database dump and re-import in a new database. You can last try to delete all PrivCheck* files in the MySQL digiKam folder.

Maik
Comment 21 Nadine 2022-04-23 19:22:42 UTC
I have been working with this same issue since 4/5/2022. I have been unable to launch Digikam since then. I have copied all data to a safe location. I upgraded DigiKam from 7.5.0 to 7.6.0. I was using MariaDB 10.6.5 on my windows 10 system. Recently i read on this forum, that MariaDB 10.6.x will not work with Digikam (although i have been using it since last November). I have reinstalled MariaDB 10.6.5, tried NariaDB 10.6.7, and more recently,  did a clean install of 10.5.15. I have also found the orphan PrivChev.ibd file and renamed it.

Now I am receiving the following error: Database process exited unexpectedly during initial connection <p>Executable: C:/Program Files/MariaDB 10.5/bin/mysqld.exe</p><p>Arguments: --defaults-file=C:\Users\Mom\AppData\Local\digikam\mysql.conf, --datadir=G:\photos\.mysql.digikam\db_data, --skip-networking=0, --port=3307</p><p>Process crashed</p>

Please advise
Comment 22 caulier.gilles 2023-10-11 05:52:07 UTC
@Nadine,

Any feedback here ?

Gilles Caulier
Comment 23 Maik Qualmann 2023-10-20 21:14:01 UTC
Fixed with Bug 475874

Maik