Liferay mysql connection issues

Liferay mysql connection issues – resolution

“com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure” : some times liferay faces connectivity issues and we even faced this liferay mysql communication link failure issue in  one of our projects

Error Log:

 Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure__The last packet successfully received from the server was 102,013 milliseconds ago.  The last packet sent successfully to the server was 0 milliseconds ago. [Sanitized]
                at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
                at sun.reflect.NativeConstructorAccessorImpl.newInstance(
                at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(
                at java.lang.reflect.Constructor.newInstance(
                at com.mysql.jdbc.Util.handleNewInstance(
                at com.mysql.jdbc.SQLError.createCommunicationsException(
                at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(
                at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(
                at com.mysql.jdbc.MysqlIO.checkErrorPacket(
                at com.mysql.jdbc.MysqlIO.sendCommand(
                at com.mysql.jdbc.MysqlIO.sqlQueryDirect(
                at com.mysql.jdbc.ConnectionImpl.execSQL(
Caused by: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost.
                at com.mysql.jdbc.MysqlIO.readFully(
                at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(
                ... 175 more


  1. check version of  mysql connector jar
  2. add autoReconnect=true,maxReconnects,rewriteBatchedStatements and failOverReadOnly parameters to JDBC url : jdbc:mysql://localhost:3306/lportal?autoReconnect=true&failOverReadOnly=false &maxReconnects=10 &rewriteBatchedStatements=true&useServerPrepStmts=false&useUnicode=yes&useFastDateParsing=false
  3. Update the below parameters in mysql and you need to edit theme in my.cnf file
    • global wait_timeout=3600;
      global interactive_timeout=230400;
      interactive_timeout = 28800
      wait_timeout = 57600
  4. set max_allowed_packet=1024  huge size if you are doing larger database writes and read.
  5. set  bind-address=”″  or bind-address=”″  in my.cnf file
  6.  Now restart the mysql and liferay servers.

Hope this will resolve your issues(still you may need to look into proxy network settings also if problem persists).