Sunday, March 28, 2010

Backup and Restore MySQL Liferay Database

In a development team you better have DB migrations that ensure your whole team can work locally pointing to the same DB schema and ideally same data.

Below are simple steps to backup and restore and existing Liferay MySQL environment:

1. Backup the source DB:
mysqldump -u root -prootroot lportal > lportal-backup.sql
2. Create the destination DB if it does not exist:
msql>create database lportal;
3. Restore the destination DB from source:
mysql -u root -proot lportal < lportal-backup.sql


4. Do not forget to re-assign permissions for liferay user
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP ON lportal.* TO 'liferay'@'localhost';
5. Login to Liferay and reindex: Go to Control Panel; Server; Server Administration; Reindex all search indexes.

2 comments:

khaled said...

Well, It really helped specially the fifth point, It was not mentioned anywhere else.

Sandeep said...

Basically we are using the backup and restore utility that is shipped with MySQL. You can read about configuring multiple databases in Liferay at
How to Configure Liferay Database

Followers