This forum has been archived. All content is frozen. Please use KDE Discuss instead.

howto restore my knotes from akonadi db?

Tags: knotes knotes knotes
(comma "," separated)
jackylau
Registered Member
Posts
10
Karma
0
Hi, all.
I wiped my kde 4.13 desktop (kubuntu 14.04) and install kde5 base distribution (kde neon).
I copy the old $HOME/.local/share/akonadi directory to my new home, but akonadi deleted all my notes when it started.
It is very terrible. I have a backup of .local directory. How can I restore my notes from .local/share/akonadi?

Last edited by jackylau on Fri Aug 11, 2017 5:29 pm, edited 2 times in total.
jackylau
Registered Member
Posts
10
Karma
0
OK, I restore my notes from db. Here is what I did:

1) start a mysqld:
Code: Select all
mysqld --defaults-file=/path/to/your/old/akonadi/mysql.conf --datadir=/path/to/your/old/akonadi/db_data --socket=/path/to/tmp/mysqld-akonadi.socket --pid-file=/path/to/tmp/mysqld-akonadi.pid


2) run mysql client:
Code: Select all
mysql --socket=/path/to/tmp/mysqld-akonadi.socket


3) run the following sql command:
Code: Select all
pager less
show databases;
use akonadi
show tables;
describe parttable;
SELECT * FROM parttable WHERE data LIKE "%knotes@%";

The last command will list all knotes records, odd record is head only, even record with the body.

4) If you saw the head record but without the body record, mark down the pimItemId of head record (assume the id is 369), and run following sql command:
Code: Select all
SELECT * FROM parttable WHERE pimItemId=369 AND partTypeId=5;

You will see the data of this record is like "1234_r23", this is the file name of this note. You can find it in /path/to/your/old/akonadi/file_db_data/.

5) The data of knotes is saved as rfc822 format in database. You can save it to a .eml file, and use kmail to view it.


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Evergrowing, Google [Bot], ourcraft