This blog will talk about how to change liferay database.

Liferay comes with a default database called “HSQL” or “Hypersonic”. This is not meant for production use however! You might need to switch to a real database to use Liferay. This page documents how to change the default database system.

Database configuration in 6.0, 6.1 is the same as 5.2.

If you need to change the database of liferay, you can choose any database e.g MySQL, PostgreSQL etc. You can change database of liferay in two ways

1. If you are installing liferay change database at that time.

2. If you have already installed liferay, you will have to make some changes.

Change Database:

If you have installed LFR, take backup of your LFR data (called Data Migration).  If you want to take backup of stored LFR data follow these steps:

1. Create a database lportal (or any name) in your database.

2. Login as administrator in LFR.

3. Select Go To –> Control Panel.

4. Select Server –> Server Administration.

Liferay change database

5. Select Data Migration Tab

Liferay change database 2

6. Fill all the details (JDBC Driver Class Name, JDBC URL, JDBC User Name, JDBC Password) in text boxes.

Liferay change database 3

(For Postgres SQL DB)


7. Select Execute

See the LFR server console, You can see the process of data migration. When the process is completed, restart the LFR Server.

As you can see in lportal database, there is lots of tables which contains LFR data.


Connect LFR to database:

Now, we have to connect LFR to database. The configuration of the database is set in a single file, To store the configuration of database, follow these steps:

1. Open new text file.

2. Write configuration of database, e.g

For PostgreSQL:



[email protected]@@@


For MySQL:



jdbc.default.username= @@@@

jdbc.default.password= $$$$$


3. Save as in {liferay-home}\{tomcat}\webapps\ROOT\WEB-INF\classes

4. Restart Liferay Server.

Now, LFR database has been changed.


NOTE:   If you are going through Data Migration Process, then JDBC URL ( jdbc:mysql://localhost:3306/lportal  in this example) should be same at both place, when you are doing Data Migration & when you are writing Configuration in


Sharad Sinha

[email protected]

Helical IT Solutions

Leave a Reply