Bug 327646 - MySQL : Failed to create tables in database" Error In digiKam [patch]
Summary: MySQL : Failed to create tables in database" Error In digiKam [patch]
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Database-Mysql (show other bugs)
Version: 3.5.0
Platform: openSUSE Linux
: NOR major
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-11-15 12:32 UTC by Christian Nyman
Modified: 2017-07-19 13:48 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.3.0


Attachments
patch to update DB schema about Images.names field (2.62 KB, patch)
2014-08-08 10:50 UTC, caulier.gilles
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Nyman 2013-11-15 12:32:48 UTC
I have a NAS with some form of linux and a MySQL server on it. I have full access from the network. I have tried this on both OpenSUSE 13.1 with Digikam 3.5 and Kubuntu 13.10 with Digikam 3.4.
What I do is, fresh install of Digikam, fresh user settings. Start digikam add folder for photos and then enter settings for MySQL database, click check db connection getting ok, then clicking [OK]. Now i get Failed to create tables in database" Error In digiKam. If I restart Digikam now I get some other fail message about some missing table entery or version.

Here are mu SQL commands:

CREATE DATABASE digikamdb;
GRANT ALL PRIVILEGES ON *.* TO 'root' IDENTIFIED BY '*****';
FLUSH PRIVILEGES;

CREATE DATABASE digikamthumbdb;
GRANT ALL PRIVILEGES ON *.* TO 'root' IDENTIFIED BY '*****';
FLUSH PRIVILEGES;

Reproducible: Always

Steps to Reproduce:
1. Add MySQL to Digikam settings, click [OK]
2.
3.
Actual Results:  
Failed to create tables in database" Error In digiKam.

Expected Results:  
Working database connection

I have tried with a regular user also to only root.
I can create and drop schemas/databases and have full access.
Comment 1 Petr Bohac 2013-11-21 21:36:55 UTC
Same problem (digiKam 3.4.0 and mariadb 10) on openSUSE Tumbleweed. It is caused by creating too long index
CALL create_index_if_not_exists('Images','image_name_index','name(996)');

Workaround:
1) edit /usr/share/kde4/apps/digikam/database/dbconfig.xml line 1002 (version 3.4.0) and replace "name(996)" by "name(255)".
2) Drop all tables in database and rerun digiKam
Comment 2 caulier.gilles 2013-11-21 21:42:40 UTC
Marcel,

Do you see the solution given in #1 ? It's acceptable for you ?

Gilles Caulier
Comment 3 Petr Bohac 2013-11-21 22:22:42 UTC
Yes it works fine and:
- filenames are usualy limited to 255 characters by filesystem
- IMHO index length 255 is still overkill, length 32 should work fine for most cases (maybe even lower)
Comment 4 caulier.gilles 2014-08-07 07:00:09 UTC
Marcel, 

There is a simple fix in comment #1 about this problem. Sound right for you to apply on database schema ? 

Gilles Caulier
Comment 5 Marcel Wiesweg 2014-08-07 17:18:44 UTC
Im no MySQL expert. If it fixes the problem, it's fine for me.
Comment 6 caulier.gilles 2014-08-08 10:50:15 UTC
Created attachment 88162 [details]
patch to update DB schema about Images.names field

Marcel,

A patch to update schema at 2 place where Images.names field is present. Schema version is also increased.

Please take a look if i don't forget something.

Gilles
Comment 7 Marcel Wiesweg 2014-08-08 16:18:15 UTC
Comment on attachment 88162 [details]
patch to update DB schema about Images.names field

Looks all right for me
Comment 8 caulier.gilles 2014-08-08 16:56:39 UTC
Git commit e0ed987c93c828f6d7ea515d01138558201db23c by Gilles Caulier.
Committed on 08/08/2014 at 16:55.
Pushed by cgilles into branch 'master'.

Update Database schema to version 2 to fix Images.names field size
FIXED-IN: 4.3.0

M  +8    -3    CMakeLists.txt
M  +2    -1    NEWS
M  +2    -2    data/database/dbconfig.xml.cmake.in

http://commits.kde.org/digikam/e0ed987c93c828f6d7ea515d01138558201db23c