migrate from sqlite to mysql

78 views
Skip to first unread message

Andrey Slusar

unread,
Jun 1, 2011, 8:08:44 AM6/1/11
to OpenVZ Web Panel
Now i'm using the sqlite3 for owp database. I need migrate from sqlite
to mysql. When i'm runs:
rake db:create RAILS_ENV="production"
rake db:migrate RAILS_ENV="production"
This is created default mysql database for owp.
How to migrate all database records from sqlite to mysql?

Andrey Slusar

unread,
Jun 1, 2011, 2:50:20 PM6/1/11
to OpenVZ Web Panel
2011/6/1 Andrey Slusar <an...@hhut.ru>
Now i'm successfully migrated:

1. sqlite3 production.sqlite3 .dump >owp.sql

2. Delete from owp.sql BEGIN TRANSACTION, COMMIT, all about 'schema_migrations' and 'sqlite_sequence', all
INSERT INTO "event_logs".

3. Change: " (double-quotes) => ` (grave accent), 'f' => '0', 't' => '1', AUTOINCREMENT =>AUTO_INCREMENT

--
Best Regards,
Andrey.

Alexei Yuzhakov

unread,
Jun 2, 2011, 11:41:12 AM6/2/11
to ovz-we...@googlegroups.com
Ok, glad to hear it. There is no automated way to migrate panel data
between sqlite and MySQL. But dumping and fixing dump file is the way.

--
Best regards,
  Alexei "SibProgrammer" Yuzhakov
  Blog: http://blog.softunity.com.ru/

Ingo Baab

unread,
Mar 28, 2014, 9:06:04 PM3/28/14
to ovz-we...@googlegroups.com
To convert the sqlite3 database with a (some) 'dirty' script (becaus of dirty content inside 
event_logs... -don't ask..) Anyhow, - I saved into -i called the file "convert_sqlite2mysql":

#!/bin/sh
echo DROP DATABASE owp\;
echo CREATE DATABASE owp\;
echo USE owp\;
sqlite3 production.sqlite3 .dump \
                                 | egrep -v -e '(BEGIN|PRAGMA|COMMIT)' \
                                 | sed 's/"/`/g' \
                                 | sed "s/'f'/'0'/g" \
                                 | sed "s/'t'/'1'/g" \
                                 | sed "s/AUTOINCREMENT/AUTO_INCREMENT/g" \
                                 | egrep -v -e '(login`|^admin|event_logs)'


And happy as Iam, call this script for direct import like this:

./convert_sqlite2mysql | mysql -u root -p owp

May it help sombody :)
Kind Regards,
-Ingo 

Rouven Polzin

unread,
May 18, 2015, 12:59:55 PM5/18/15
to ovz-we...@googlegroups.com
how can i switch OWP from sqlite3 to MySQL ?
I Converted and Imported the Database to MySQL, but how can i connect to it?

Ananias Filho

unread,
May 18, 2015, 1:12:26 PM5/18/15
to ovz-we...@googlegroups.com

Ananias Filho - kram3r

--
You received this message because you are subscribed to the Google Groups "OpenVZ Web Panel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ovz-web-pane...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Rouven Polzin

unread,
May 20, 2015, 1:36:36 PM5/20/15
to ovz-we...@googlegroups.com
Thank you!
Reply all
Reply to author
Forward
0 new messages