seafile从sqlite迁移到mysql
发布时间:2020-12-12 19:19:36 所属栏目:百科 来源:网络整理
导读:sqlite3.exe下载文件sqlite-shell-win32-x86-3071300.zipFirst 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_se
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; (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |