[one-users] Convert OpenNebula DB from sqlite to MySQL

Vladislav Gorbunov vadikgo at gmail.com
Thu Oct 25 19:44:52 PDT 2012


Manual for convert OpenNebula DB from sqlite to MySQL:
http://vadikgo.tumblr.com/post/34325489321/convert-opennebula-db-from-sqlite-to-mysql

Create MySQL database opennebula, grant access to user oneadmin with
password onepass

Get convert script sqlite2mysql.pl from the
http://stackoverflow.com/questions/18671/quick-easy-way-to-migrate-sqlite3-to-mysql

Stop oned:
service oned stop

Dump sqlite database to file:
sqlite3 /var/lib/one/one.db .dump | ./sqlite2mysql.pl > mysql.sql

Remove first line PRAGMA foreign_keys=OFF; from the mysql.sql

Load sql data to database:
mysql -u oneadmin -p opennebula < mysql.sql

Change /etc/one/oned.conf from
DB = [ backend = "sqlite" ]
to
DB = [ backend = "mysql",
        server  = "localhost",
        port    = 0,
        user    = "oneadmin",
        passwd  = "onepass",
        db_name = "opennebula" ]

Check MySQL database:
onedb fsck -v -S localhost -u oneadmin -p onepass -d opennebula

Start oned:
service oned start



More information about the Users mailing list