Follow these instructions to configure your Liferay portal with MySQL SGBD :
- Downloading the jdbc Driver
For MySQL, there is no need to download the jdbc driver. When Liferay detects you want to use MySQL, it will automatically include the driver (mysql.jar) in your $TOMCAT_HOME/lib/ext.
- Creating the blank database
Create a blank database using the UTF-8 encoding and give it a name. Let’s consider that the created database is “lportal”.
- Updating portal-ext.properties
Open your portal-ext.properties file and past the following lines :
1 2 3 4 5 |
# MySQL jdbc.default.driverClassName=com.mysql.jdbc.Driver jdbc.default.url=jdbc:mysql://localhost/lportal?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false jdbc.default.username=root jdbc.default.password=root |
Set the correct username and password to connect to your database.
The portal-ext.properties is located in the same folder as your $TOMCAT_HOME. If it doesn’t exist, create it.
- Check the configuration
During the server start, you can check that Liferay started with the appropriate dialect by looking for the following lines in your server log console/file:
1 2 |
14:23:20,480 INFO [localhost-startStop-1][DialectDetector:71] Determine dialect for MySQL 5 14:23:20,574 INFO [localhost-startStop-1][DialectDetector:136] Found dialect org.hibernate.dialect.MySQLDialect |
If you go back to your database, you will see that it’s now populated by about 180 data tables that Liferay created on startup.
If you already configured your portal with hsql and want to re-configured it with the MySQL Database and add samples data, open portal-setup-wizard.properties file located in the same folder as portal-ext.properties. Set the setup.wizard.enabled to true and restart your server.