前端之家收集整理的这篇文章主要介绍了
seafile从sqlite迁移到mysql,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
sqlite3.exe
下载文件sqlite-shell-win32-x86-3071300.zip
First make sure the python module for MysqL is installed. On Ubuntu,use sudo apt-get install python-MysqLdb to install it.
Download these three files to /data/haiwen,ce_ccnet_db.sql,ce_seafile_db.sql,MysqL.sql(used for create tables in seahub_db).
Rename MysqL.sql to ce_seahub_db.sql: mv MysqL.sql ce_seahub_db.sql. Now you should have the following directory layout.
seahub.db
seafile.db
groupmgr.db
orgmgr.db
usermgr.db
1. 导出成指定的sql脚本
将sqlite中指定的数据表以sql创建脚本的形式导出,具体命令
ywx@ywx:~/yu/sqlite$ sqlite3 test.db
sqlite version 3.7.7.1 2011-06-28 17:39:05
Enter ".help" for instructions
Enter sql statements terminated with a ";"
sqlite> .output data.sql
sqlite> .dump
sqlite>
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE `Group` (`group_id` INTEGER PRIMARY KEY AUTOINCREMENT,`group_name` VARCHAR(255),`creator_name` VARCHAR(255),`timestamp` BIGINT,`type` VARCHAR(32));
INSERT INTO "Group" VALUES(1,'信息科技部','015208@zjtlcb.com',1491567534304229,NULL);
CREATE TABLE `GroupUser` (`group_id` INTEGER,`user_name` VARCHAR(255),`is_staff` tinyint);
INSERT INTO "GroupUser" VALUES(1,1);
CREATE TABLE GroupDNPair (group_id INTEGER,dn VARCHAR(255));
DELETE FROM sqlite_sequence;
INSERT INTO "sqlite_sequence" VALUES('Group',1);
CREATE UNIQUE INDEX groupid_username_indx on `GroupUser` (`group_id`,`user_name`);
CREATE INDEX username_indx on `GroupUser` (`user_name`);
COMMIT;
Create 3 databases ccnet_db,seafile_db,seahub_db and seafile user.
MysqL> create database ccnet_db character set = 'utf8';
MysqL> create database seafile_db character set = 'utf8';
MysqL> create database seahub_db character set = 'utf8';
Import ccnet data to MysqL.
MysqL> use ccnet_db;
MysqL> source ce_ccnet_db.sql;
MysqL> source ccnet_db_data.sql;
原文链接:https://www.f2er.com/sqlite/198282.html