-
Install mysql and sqlite3 client
apt install mysql-server-5.6 mysql-client-5.6 sqlite3
-
Create the etherpad database (replace
PASSWORD
with some password)mysql -u root -p create database `etherpad`; grant all privileges on `etherpad`.* to 'etherpad'@'localhost' identified by 'PASSWORD'; use `etherpad`; CREATE TABLE `store` ( `key` varchar(100) COLLATE utf8mb4_bin NOT NULL DEFAULT '', `value` longtext COLLATE utf8mb4_bin NOT NULL, PRIMARY KEY (`key`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; insert into store values ("MYSQL_MIGRATION_LEVEL", "1");
-
Stop etherpad
service etherpad-lite stop
-
Export sqlite database to tab-separated values
cd /var/local/etherpad-lite/etherpad-lite/ sqlite3 -column -csv -separator $'\t' var/sqlite.db "select * from store" > /tmp/sqlite.db.csv chgrp mysql /tmp/sqlite.db.csv
-
Import data into mysql
mysql -u root -p etherpad -e "load data infile '/tmp/sqlite.db.csv' into table store character set utf8mb4 fields escaped by '\"' terminated by '\t' enclosed by '\"';"
-
Open the etherpad settings
/var/local/etherpad-lite/etherpad-lite/settings.json
and comment out:"dbType" : "sqlite", "dbSettings" : { "filename" : "var/sqlite.db" },
-
Replace with (and replace
PASSWORD
with the etherpad database password):"dbType" : "mysql", "dbSettings" : { "user": "etherpad", "host": "localhost", "database": "etherpad", "password": "PASSWORD", "port" : "/var/run/mysqld/mysqld.sock" },
-
Also, set
maxAge
to99999999
-
Restart etherpad
service etherpad-lite start
-
Clean up:
rm /tmp/sqlite.db.csv rm /var/local/etherpad-lite/etherpad-lite/var/sqlite.db
Last active
June 6, 2017 16:07
-
-
Save pipitone/7bad67eb7b450e3cf65e34b3b2d67221 to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment