Release Notes:Clone Database

Xibo uses database constraints to enforce it's database schema. You can think of it as a second level of checking after the web interface to ensure that the database remains corruption-free.

What this means for you, the Xibo admin, is that when you try and restore a mysqldump'ed database the restore will fail.

I'll use the following names for things throughout the examples. Substitute these values for your real database details:


 * MySQL Administrative User = madmin
 * MySQL Xibo User = xibodbuser
 * MySQL Database = xibodb

Method 1
The easier of the two methods. mysqldump -u madmin -p xibodb > xibo.sql
 * Dump the 1.0.x database to a file:

mysql -u madmin -p mysql
 * If you now want to clone that database (for testing or similar) then first you need to create a new database to restore the dump in to:

create database xibodb2; grant all privileges on xibodb2.* to 'xibodbuser'@'localhost'; use xibodb2; source xibo.sql quit;
 * You'll be prompted to enter your madmin password. At the mysql prompt, enter:

Substitute xibodb2 for any database name of your choosing (although clearly it can't exist already!).
 * Finally alter your settings.php file in your 1.1 install to use the new database name (xibodb2 in this example).

Method 2
Before you backup your database, create a file "xibo.sql" with the following contents:

SET FOREIGN_KEY_CHECKS=0; SET UNIQUE_CHECKS=0; It's really important that there is at least one blank line on the end of the file.

Next you dump your Xibo database and add the output to the end of xibo.sql mysqldump -u xibodbuser -p xibodb >> xibo.sql

You will be prompted to enter the password for your xibodbuser account. You could replace xibodbuser with your madmin credentials instead. xibo.sql should now contain a dump of your working Xibo database.

If you now want to clone that database (for testing or similar) then first you need to create a new database to restore the dump in to: mysql -u madmin -p mysql

You'll be prompted to enter your madmin password. At the mysql prompt, enter: create database xibodb2; grant all privileges on xibodb2.* to 'xibodbuser'@'localhost'; quit;

Substitute xibodb2 for any database name of your choosing (although clearly it can't exist already!).

Now we can restore our database dump in to the new database: mysql -u madmin -p xibodb2 < xibo.sql

That should give you a clone of your Xibo database. You can now modify your settings.php file to use the new database name.