Bug 316747 - MIGRATION : Error on database schema creation
Summary: MIGRATION : Error on database schema creation
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Database-Migration (show other bugs)
Version: 3.1.0
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-03-15 00:51 UTC by jree2kx
Modified: 2015-11-19 15:01 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description jree2kx 2013-03-15 00:51:30 UTC
I have never been able to get digikam to work with an external mysql database. I have been trying since 2.9.0. I have a user set-up named "kdeuser" and have with all privileges on the 2 databases I set up for digikam "digikam" & "thumbnails". The user I configured works just fine with the akonadi and amarok databases. I have tried migrating and just setting the db in settings. Both fail. Digikam does create some tables before it errors out. I have searched for a solution for about 2 months and waited for updates before filing a bug report.

Reproducible: Always

Steps to Reproduce:
1.  migrate to external mysql db
2.
3.
Actual Results:  
i7-Arch ~ $ digikam
QSqlDatabasePrivate::removeDatabase: connection 'ConnectionTest' is still in use, all queries will cease to work.
digikam(6168)/digikam (core): DBVersion not available! Giving up schema upgrading. 
[0x265ec28] main services discovery error: no suitable services discovery module

Expected Results:  
database should have been populated
Comment 1 caulier.gilles 2014-08-07 06:54:34 UTC
Problem still reproducible using last digiKam 4.2.0 release ?

Gilles Caulier
Comment 2 caulier.gilles 2015-11-19 15:01:20 UTC
Git commit 74adf4f5dcdacc4b6574e61f55dac956fa4c7611 by Gilles Caulier.
Committed on 19/11/2015 at 14:38.
Pushed by cgilles into branch 'master'.

First stage to fix Mysql support:

- For Internal server:
  Use the current system user to run mysql_installdb program to init local database and server tables.
  The database is always installed in user account (~/.local/share/digikam/). The goal is to set this install path configurable as with SQlite.
  Check the value returned to start init and sever program with QProcess. If something is wrong abort the sequence and do not try to populate/use the database.
  This will fix a crash if DB backend is null at digiKam shutdown.
  Fix the default embeded mysql server configuration to not need grant privilege with index creation.

- For remote server:
  Fix the index creation procedure SQL statements to not check security rules. No more grant privilege is required,
  excepted for the DB tables and the standard DB user dedicated for digiKam use.
  Important : for a remote server, the database creation need to be instanced by administrator, using following SQL statements (which will be put in DB setup page later as helper):

  * For a common Mysql database storage :

  CREATE DATABASE digikamdb; GRANT ALL PRIVILEGES ON digikamdb.* TO 'digikam'@'localhost' IDENTIFIED BY 'digikam'; FLUSH PRIVILEGES;

  with:

  digikamdb       : the common database name (storing Core, Thumbnails, and Face databases).
  digikam/digikam : the name/password of user account used by digiKam to access on mysql server.

  * For separated Mysql database storages :

  CREATE DATABASE digikamcoredb; GRANT ALL PRIVILEGES ON digikamcoredb.* TO 'digikam'@'localhost' IDENTIFIED BY 'digikam'; FLUSH PRIVILEGES;
  CREATE DATABASE digikamthumbsdb; GRANT ALL PRIVILEGES ON digikamthumbsdb.* TO 'digikam'@'localhost' IDENTIFIED BY 'digikam'; FLUSH PRIVILEGES;
  CREATE DATABASE digikamfacedb; GRANT ALL PRIVILEGES ON digikamfacedb.* TO 'digikam'@'localhost' IDENTIFIED BY 'digikam'; FLUSH PRIVILEGES;

  with:

  digikamcoredb   : the Core database name.
  digikamthumbsdb : the Thumbnails database name.
  digikamfacedb   : the Face database name.
  digikam/digikam : the name/password of user account used by digiKam to access on mysql server.

- The Face recognition database is now fully integrated in Mysql support. A new settings have been add to DB setup page.
Related: bug 311041, bug 327062, bug 279580, bug 283502
FIXED-IN: 5.0.0

M  +29   -15   databaseserver/databaseserver.cpp
M  +4    -0    databaseserver/databaseserver.h

http://commits.kde.org/digikam/74adf4f5dcdacc4b6574e61f55dac956fa4c7611