Rearranging the digiKam tag tree

XML Stylesheet Language - Transformations.

Argh, the far too frequent issue that I make long confusing sentences struck again (I am not native English speaker, but that’s a poor excuse). What I did was the following: First I created a new second level tag and one additional child tag. I did not assign these tags to any images. Then I moved the new second level tag together with it’s child to another top level tag. This move produced the command line output I posted earlier. Then I restarted digikam and the two tags I moved remained at the new position.

So I repeated the same procedure but now I first assigned the tags to be moved to some random images. Again the move persisted. However I can also confirm that it does not change the tags in the image metadata - which clearly is a bug. This can easily be resolved by either writing the image metadata to file or using the maintenance tool - nevertheless it is definitely a bug in itself.

And I can say that I am using internal mysql for a long time now and didn’t have problems (which doesn’t have to mean anything, that I use just a subset of the functionality present).

EDIT:
I couldn’t find any existing bug about metadata adjusting yet, I will open it.
The mysql error I posted before is: 383326 – Moving a tag does not update the parent tag correctly

EDIT2:
File the issue about moved tag not being applied to file metadata: 386224 – Metadata is not updated when moving tags

@elle, xslt is a templating language that is XML aware, more or less. So I can read in XMP files, which are XML, manipulate the structure or content of the XMP tag.

XSLT generally runs using java and the Saxon library.

Yes, that’s the way I read it as well. Thanks to @rasimo for testing it! I haven’t yet tried mysql for the database as it’s still labeled “experimental” but it seems that the risks are small, so I might give it a try when I get a chance.

@rasimo - thanks! for filing the bug report and for testing with a tag tree that had images assigned. As soon as I finish organizing my image files (a task independent of digiKam), I’ll try making a mysql database.

Does it matter if one uses mariadb or mysql? Neither is currently installed on my computer. I’m not even sure if mariadb is still around, come to think of it.

I am by no means an expert, but from what I read mariadb is the more actively maintained/progressive/free variant of mysql. At least it is what I have on my system and I think it also is the default for debian.

mySQL = property of Oracle. Oracle is slowly killing it.

mariaDB = fork of mySQL before oracle got it.

mariaDB is a drop in replacement for mySQL and receives much of the development efforts now.

Thanks! @rasimo and @paperdigits - It’s been years since I bothered to install any database besides sqlite. So “mariadb vs mysql” was just a dim memory of having read “something” a long time ago. The wikipedia article on mariadb gives a good summary, sounds like they took all the real developers with them when they forked from mysql when oracle took over. So mariadb it will be.

Oracle has used its corporate efficiency to kill everything sun had built. :wink:

I installed mariadb. The next question is how does one use mariadb instead of sqlite with digiKam. Can anyone outline the steps or provide a link to a recent and still valid “how to”?

I did a quick internet search, and all the suggested pages seemed to be about earlier versions of digiKam. One of the articles gave a “must have this” qt library, that isn’t even in gentoo portage, at least not under any library name that I could find with repeated equery searches using wildcards. A lot has changed with KDE between KDE4 and KDE5.

Settings > database migration. Change only options in the right hand panel.

Hmm, that sounds easy, except I can’t find “Settings > database migration”. Is it under “Settings/Configure digiKam”? Or is a top-level option under Settings? Either way, I don’t see it (which doesn’t mean it’s not there). If it matters, I’m using digiKam 5.7.0.

Oh, now I feel silly. I didn’t reset a Gentoo use flag to actually use mysql - I set those use flags a long time ago. I bet as soon as I change the use flag to actually use mysql and recompile, there will be an option to use mysql. :blush:

1 Like

@Elle

It should be right above “configure digikam” in the settings menu :wink:

Also did you see that the digikam wizard Maik has committed a patch that should solve the problem with moving tag trees in sqlite? The change looks ridiculously small and I didn’t try out myself (I use mysql), but coming from Maik, I am pretty confident that it works.

OK, I have the database migration dialog open. There are two options:

  1. Mysql Internal
  2. Mysql Server

I suspect (remembering way back) that the easier option is Mysql Internal, as the other option requires that I already made a database and set a password and etc - something I’d prefer to avoid if at all possible because the last time I tried to do this did not meet with success.

But the Mysql Internal option seems to want me to find the “mysql_install_db” binary, and I don’t have a clue what to do or where to look, so advice is very welcome!

Oh, wait. mysql_install_db is located at /usr/share/mysql/scripts/mysql_install_db - on to the next step.

Hmm, having found where mysql_install_db is, now digiKam doesn’t want to put the database where I asked it to. In fact it gave a complaint, I forget the verbiage, and then promptly lost track of where mysql_install_db is located. So I officially give up. Sigh.

OK, trying again, the error message when I hit the “Migrate” button is “Error while opening the target database” - well, this makes sense as there currently isn’t any mariadb database.

Am I supposed to create the mariadb database in the first place? If so, how do I do this? I assumed digiKam would find the current sqlite database which is in /home/elle/Pictures, make a new mariadb database, and migrate the data from the sqlite database to the mariadb database.

Here’s the relevant digiKam terminal output:

digikam.general: All Binaries Found :  true
digikam.dbengine: ConnectOptions  "UNIX_SOCKET=/home/elle/.local/share/digikam/db_misc/mysql.socket"
digikam.dbengine: Error while opening the database. Error was QSqlError("2002", "QMYSQL: Unable to connect", "Can't connect to local MySQL server through socket '/home/elle/.local/share/digikam/db_misc/mysql.socket' (2 \"No such file or directory\")")
QXcbConnection: XCB error: 3 (BadWindow), sequence: 4930, resource id: 15293461, major code: 40 (TranslateCoords), minor code: 0
digikam.dbengine: ConnectOptions  "UNIX_SOCKET=/home/elle/.local/share/digikam/db_misc/mysql.socket"
QSqlDatabasePrivate::addDatabase: duplicate connection name 'MigrationToDatabase81660432', old connection removed.
digikam.dbengine: Error while opening the database. Error was QSqlError("2002", "QMYSQL: Unable to connect", "Can't connect to local MySQL server through socket '/home/elle/.local/share/digikam/db_misc/mysql.socket' (2 \"No such file or directory\")")

Based on the terminal output, I’m guessing the only way forward is to start mysql outside of digiKam, change the default password, and make a new database, and change “localhost”, as per the information on this page: MySQL/Startup Guide - Gentoo Wiki

I was hoping that digiKam would do all this stuff automagically . . .

If you’re using the internal mySQL, digikam should handle the database init, schema creation, and user creation. If you’re using an external mySQL database, you’ll need to do all of that yourself.

Well, I followed the Gentoo mysql startup guide and indeed got mysql to start. But digiKam still doesn’t want to make a database, fails with the following terminal output, which I don’t know how to troubleshoot:

digikam.general: Event is dispatched to desktop notifier through DBUS
digikam.general: Testing  "mysql_install_db" ...
digikam.general: Testing  "mysqld" ...
digikam.general: Testing  "mysql_install_db" ...
digikam.general: Testing  "mysqld" ...
digikam.general: Testing  "/usr/bin/mysql_install_db" ...
digikam.general: All Binaries Found :  false
digikam.general: Testing  "/usr/bin/mysqld" ...
digikam.general: All Binaries Found :  false
digikam.general: Testing  "/usr/sbin/mysql_install_db" ...
digikam.general: All Binaries Found :  false
digikam.general: Testing  "/usr/sbin/mysqld" ...
digikam.general: Found  "/usr/sbin/mysqld"
digikam.general: All Binaries Found :  false
digikam.general: Testing  "mysql_install_db" ...
digikam.general: Testing  "mysqld" ...
digikam.general: Testing  "mysql_install_db" ...
digikam.general: Testing  "mysqld" ...
digikam.general: Testing  "/usr/bin/mysql_install_db" ...
digikam.general: All Binaries Found :  false
digikam.general: Testing  "/usr/bin/mysqld" ...
digikam.general: All Binaries Found :  false
digikam.general: Testing  "/usr/sbin/mysql_install_db" ...
digikam.general: All Binaries Found :  false
digikam.general: Testing  "/usr/sbin/mysqld" ...
digikam.general: Found  "/usr/sbin/mysqld"
digikam.general: All Binaries Found :  false
digikam.general: Testing  "/usr/share/mysql/scripts//mysql_install_db" ...
digikam.general: Found  "/usr/share/mysql/scripts//mysql_install_db"
digikam.general: All Binaries Found :  true
digikam.dbengine: ConnectOptions  "UNIX_SOCKET=/home/elle/.local/share/digikam/db_misc/mysql.socket"
digikam.dbengine: Error while opening the database. Error was QSqlError("2002", "QMYSQL: Unable to connect", "Can't connect to local MySQL server through socket '/home/elle/.local/share/digikam/db_misc/mysql.socket' (2 \"No such file or directory\")")
QXcbConnection: XCB error: 3 (BadWindow), sequence: 5756, resource id: 14691197, major code: 40 (TranslateCoords), minor code: 0
digikam.general: Testing  "mysqld" ...
digikam.general: All Binaries Found :  true

Does this error come up immediately after creating the database?

I got the same error when I corrupted the database (I was foolish enough to bidirectionaly sync the database while in use → bad idea), the only solution was to restore the backup. So deleting your database to be sure that you have a fresh/clean start might help.

Hi @rasimo - the mysql database actually never got created - the “progress” sliders never moved. Anyway, in the meantime I decided to just uninstall all that mysql/mariadb stuff and go back to using sqlite.

A long time ago I set wordpress up on my test apache server, which required going from “Linux/Apache/PHP” to “Linux/Apache/Mysql/PHP” and set up the rquired databases. Everything worked, so I know it can be done. One of these days I’ll try again with mysql for digiKam but for now there are other things that need attention.