This tutorial is licensed under CC-BY-SA - feel free to share and modify it (but keep information free)!
This tutorial was originally written for the first Seafile forum of Seafile GmbH. Since the announcement to fork Seafile by Seafile GmbH I've decided to move my tutorials to the new Seafile forum of the original developers of Seafile (so this one).
This tutorial version is the maintained one.
Tutorial for importing old MySQL/MariaDB databases and old SEAFILE-DATA
(This tutorial is an add-on for Tutorial for Seafile CE + Nginx + dynamic DNS (on ARM / Cubietruck / RaspberryPi))
Here are some more information how to do the process of restoring/importing existing seafile data. Maybe some commands are redundant. This is for confirming the right settings.
Variables are marked as %%variable%%.
I. Setup a new Seafile installation manually with standard settings
II. Drop the new database tables/user
[stop your seafile server manually or with your script]#
mysql -u root -p
DROP DATABASE `ccnet-db`;
DROP DATABASE `seafile-db`;
DROP DATABASE `seahub-db`;
SELECT User FROM mysql.user;
DROP USER 'username'@'localhost';
III. Create new databases/user:
CREATE DATABASE `ccnet-db`;
CREATE DATABASE `seafile-db`;
CREATE DATABASE `seahub-db`;
CREATE USER '%%YourMySQL-UserForSeafile%%'@'localhost' IDENTIFIED BY '%%PasswordFor%%YourMySQL-UserForSeafile%%%%';
IV. Import your intended databases
In a second Terminal:
mysql -u root -p ccnet-db < %%ccnet-db_BACKUP%%.sql
mysql -u root -p seafile-db < %%seafile-db_BACKUP%%.sql
mysql -u root -p seahub-db < %%seahub-db_BACKUP%%.sql
In your first Terminal:
GRANT ALL PRIVILEGES ON `ccnet-db`.* to `%%YourMySQL-UserForSeafile%%`@localhost;
GRANT ALL PRIVILEGES ON `seafile-db`.* to `%%YourMySQL-UserForSeafile%%`@localhost;
GRANT ALL PRIVILEGES ON `seahub-db`.* to `%%YourMySQL- UserForSeafile%%`@localhost;
V. Change seafile-data directory
su - %%YourSystemUserNameForSeafile%% -s /bin/bash
cp %%/path/to/old-seafile-data%% %%/path/to/seafile/%%
VI. Ensure that intended seafile-data (for example on the external drive) belongs to Seafile user (recursively)
In your second Terminal:
chown -R %%YourSystemUserNameForSeafile%%:%%YourSystemGroupNameForSeafileUser%% %%/path/to/seafile-data%%
In your first Terminal:
ln -s %%/path/to/seafile-data%% seafile-data
#If there is an error it maybe happened because the seafile user can not access the mother directory of seafile-data even if your seafile-user owns the seafile-data directory so CHOWN the folder which contains seafile-data to your seafile-user:
chown -R %%YourSystemUserNameForSeafile%%:%%YourSystemUserNameForSeafile%% %%/path/mother/directory/of/seafile-data%%)
VII. Confirm that there is the right MySQL password for
Open the following .conf files and confirm that there is the new MySQL password:
VIII. Start your Seafile server
report any bugs in this thread
report if it works and if some sentences/comments are confusing (and why).
ask all questions in this thread and not via PM (there are no stupid questions for me)