Rearranging the digiKam tag tree

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.

Thank You, ashurbanipal, for this good explanation of your tag tree fixing process.

I already had a similar plan, but you have a step or two that will take a bit of the work out of the way I had planned.

Considering this statement “then write the changes to the files” , maybe it is something I did in configuration, but when I tag something in digiKam, that tag is permanently in the images metadata as soon as the “Apply” is done; where is this “write the changes” button and is it a step I need to be following?

Thanks.

It’s available under the “More” dropdown at the bottom of the Captions sidebar; I select the images and then choose the “Write metadata to each file” option. It’s probably overkill on my part, but at one point in the past I ran in to issues with tags not being saved in the files themselves and adding this step seemed to solve the problem. That was a long time ago, though, when digiKam was more prone to crashing when I did a lot of tagging. I was also testing some other programs for tagging, and i suspect that’s part of the problem as well. In any case, if tagging is working for you it’s probably safe to skip. :slight_smile:

1 Like

Thank you.

I am on my third revision of digiKam, 5.6.0, and a lot of things work now that used to were there but didn’t work.

I’ve been using it for quite a while, can’t even remember which version I started with. One of the early 4.x releases, I think. It was pretty amazing, really, even back then. With all the additional features it’s even better today! Always been pretty stable for me, too. :slight_smile: