Tutorials/Shared Database/fr: Difference between revisions

From KDE UserBase Wiki
(Created page with "{{Warning| Ce fichier désactive « l'accès au réseau » et « l'authentification de l'utilisateur ». Ce dernier signifie que n'importe quelle application de votre ordinateur peut s'y connecter sans mot de passe. Cela facilite la configuration des programmes et convient bien au cas d’utilisation général du bureau.}}")
(Created page with "==== Création des bases de données ====")
Line 22: Line 22:
{{Warning| Ce fichier désactive « l'accès au réseau » et « l'authentification de l'utilisateur ». Ce dernier signifie que n'importe quelle application de votre ordinateur peut s'y connecter sans mot de passe. Cela facilite la configuration des programmes et convient bien au cas d’utilisation général du bureau.}}
{{Warning| Ce fichier désactive « l'accès au réseau » et « l'authentification de l'utilisateur ». Ce dernier signifie que n'importe quelle application de votre ordinateur peut s'y connecter sans mot de passe. Cela facilite la configuration des programmes et convient bien au cas d’utilisation général du bureau.}}


==== Creating the databases ====
<span id="Creating_the_databases"></span>
==== Création des bases de données ====


The first thing we have to do once '''MySQL''' is installed and running is add a separate database for each program. I generally name them after the programs that use them. This can be done with either GUI administration tools, but since we only have to do it once it's probably faster to write a few commands:
The first thing we have to do once '''MySQL''' is installed and running is add a separate database for each program. I generally name them after the programs that use them. This can be done with either GUI administration tools, but since we only have to do it once it's probably faster to write a few commands:

Revision as of 20:05, 23 May 2024

Base de données partagée

Il existe plusieurs applications de bureau pour KDE qui gèrent une sorte de base de données. Les plus populaires sont probablement Amarok le lecteur de musique, digiKam le gestionnaire de photos et Akonadi le cadre d'informations personnelles. Pour simplifier leur installation et limiter leurs besoins, chacun de ces programmes embarque sa propre base de données, utilisant dans la plupart des cas SQLite. Avoir de nombreuses bases de données distinctes crée une surcharge inutile et rend plus difficile la sauvegarde de vos données.

Serveur de base de données

La seule base de données universellement supportée par ces programmes est MySQL, c'est donc celle que nous utilisons bien. Elle est également très simple à configurer, soit en ligne de commande, soit avec des outils graphiques.

Installation

Tout d’abord, nous devons installer le serveur MySQL. Les utilisateurs de Linux voudront probablement installer un package à partir de leur distribution, d'autres pourront l'obtenir depuis leur page d'accueil. Les instructions pour démarrer MySQL au démarrage sont spécifiques à la distribution, mais comme MySQL est un package populaire, elles ne devraient pas être difficiles à trouver. Lors de l'installation, le programme d'installation vous demandera probablement un mot de passe root. Choisissez un mot de passe sécurisé pour cela et souvenez-vous-en, ce compte ne sera pas utilisé par les applications de bureau mais uniquement pour l'administration de la base de données.

Configuration

For the server configuration, this we will assume that your database server is not used over the network, contains no sensitive data, and that you trust your applications. If you plan to use this database for Akonadi data, it's best if you copy the configuration file from the Akonadi code repository, which can be downloaded at here. Make a copy of your existing /etc/mysql/my.cnf, then replace it with the downloaded file.

Warning

Ce fichier désactive « l'accès au réseau » et « l'authentification de l'utilisateur ». Ce dernier signifie que n'importe quelle application de votre ordinateur peut s'y connecter sans mot de passe. Cela facilite la configuration des programmes et convient bien au cas d’utilisation général du bureau.


Création des bases de données

The first thing we have to do once MySQL is installed and running is add a separate database for each program. I generally name them after the programs that use them. This can be done with either GUI administration tools, but since we only have to do it once it's probably faster to write a few commands:

$ mysql -u root -p

At the password prompt, type in the root password set when installing MySQL. Now we can start creating databases. For example, to create a database named 'amarok', type in this command:

mysql> create database amarok;

Amarok

Amarok requires very little configuration, but it doesn't provide a way to migrate your old database. Go to Settings -> Configure Amarok... and go to the Database tab. Fill in localhost in the Server textfield, 3306 in Port, and amarok in Database.

digiKam

Note

digiKam used to have a bug which prevented the same from working in versions prior to 2.0, so you will need a newer version of the program. In version 2.0 is still doesn't work perfectly: it pops up an error message at startup, but the tables are populated and the album data is stored correctly.

digiKam is somewhat special because it requires two databases: one for the images metadata, and one for thumbnails. Their names are not important, I chose to call them digikam and digikam_thumb:

mysql> create database digikam;
mysql> create database digikam_thumb;

In digiKam, the process is very similar to that of Amarok. The settings are located in Settings -> Configure digiKam... -> Database.

digiKam also comes with a handy database migration tool, available in Settings -> Database Migration. Fill in your previous database settings (you don't have to do anything if you haven't changed these options) on the left side and your new settings on the right side, then click Migrate.

Akonadi

First create a database for Akonadi:

mysql -u root -p
create database akonadi;

Akonadi is not supposed to be a user-facing tool, so there is no configuration GUI for it. However, you can edit ~/.config/akonadi/akonadiserverrc to have these contents:

[%General]
Driver=QMYSQL

[QMYSQL]
Name=akonadi
Host=localhost
StartServer=false
Options=
ServerPath=/usr/bin/mysqld

Save the file, then log out and log in back again.