If you observed the Liferay server log then you will come to know that Liferay will put log something like
“Liferay is configured to use Hypersonic as its database. Do NOT use Hypersonic in production. Hypersonic is an embedded database useful for development and demo’ing purposes. The database settings can be changed in portal.properties.”
In Production, generally MySQL or any other DB is used (like MS-SQL or Oracle). So it’s always better way to have same environment for development as in production. (Like JDK Version, Liferay version, DB and its version etc).
I would recommended to look at index page ‘A Complete Liferay Guide‘ to browse all topics about liferay.
Suppose, in your production environment, you have used MySQL so its advisable to Configure Liferay with MySQL for your development environment also.
Configure Liferay with MySQL
In this article we will see how to Configure Liferay with MySQL. This requires change in configuration so that it points to MySQL rather than HSQLDB.
create portal-ext.properties file under your Tomcat bundle(Liferay server) folder as shown in below screenshot.
Next, add following content in it.1 2 3 4 | jdbc.default.driverClassName=com.mysql.jdbc.Driver jdbc.default.url=jdbc:mysql://localhost/techblog?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false jdbc.default.username=root jdbc.default.password=root |
Explanation:-
- The first line shows the driver name
- The second line form a DB url. localhost is the host name. If your MySQL DB is located on remote machine, you have to give host name(localhost in our case) or IP address of that machine. Next to it is techblog which is nothing but the schema in MySQL which will create shortly. The rest are the parameters like Character encoding and uni-code etc.
- The third and fourth properties shows the username and password of MySQL Db
So let’s create blank schema in MySQL. Give its name as techblog.
Initially there won’t be any tables.
Now start the Liferay server. (If Liferay server is already started,then you need to stop the server and then start)
First time during start up it will take some time ,as it will create all Tables,index and pre-populated values. Once the Liferay server is started, you may revisit the techblog schema and confirm that the tables are created properly.
Also from tomcat log, you can observed that now it will take MySQL dialect rather than HSQLDB. It’s also possible to configure liferay with other database in similar way we configure Liferay with MySQL here.
And its done. Feel free to ask any questions. I will try my best to get the answers.
I would recommended to look at index page ‘A Complete Liferay Guide‘ to browse all topics about liferay.






can u please suggest a book or something to have complete understanding of portlets for liferay
Hello Sai,
Per my knowleget, there no book which gives you complete in depth of Liferay. You need to refer various books, liferay forum, liferay documentation and other personal blogs to get an idea.
Feel free to ask any questions / give suggestion.
Regards
Nilang
I exactly did the same and I got this error:
15:09:41,292 ERROR [localhost-startStop-1][DataSourceFactoryImpl:110] Unable to lookup jdbc/LiferayPool
javax.naming.NameNotFoundException: Name [jdbc/LiferayPool] is not bound in this Context. Unable to find [jdbc].
Can some one please help me?
Hi Vineela,
Welcome to Tech blog and sorry for late response. From the log, it seems issues is not with the Liferay but with the Data source that you configured (JNDI) pls check it
Regards
Nilang
Hello Sir,
Could you please post an article on how to set up all the necessary environment variables to begin the Liferay Development? Of late, I am getting lots of errors to start the tomcat itself.
Thanks-Mahesh
Hi Mahesh,
Welcome to Techblog. May I know which version of liferay you are trying to configure ? May I have your error stack trace. Please provide this info so that I can guide you properly.
Hi –
I added mysql to liferay by following your post. However, once I closed Eclipse and restarted it, now I get an error saying “Unable to find jdbc and it says jdbc/mydb not found in this Context”
I googled and tried a few things but nothing seems to fix the issue and it feels like some file is cached somewhere that is causing the problem. Any ideas?
Thanks!
Hi,
Welcome to Techblog. I assume that you put your db entries in context.xml file from eclipse. Stop Eclipse and make sure that this entry(About data source) is present in context.xml. If not then go to Liferay-Tomcat/conf folder and open context.xml file in some editor like notepad++ and then add data source entry.
After this, when you start eclipse, do same changes in context.xml file you are able to see from server folder of eclipse.
Now start server and then restart eclipse and check it. Hopefully it should work.
Regards
Nilang