MySQL Error 2006: MySQL Server Has Gone Away


I got MySQL error 2006: MySQL server has gone away when I was importing my big database. This error is caused by low default setting of max_allowed_packet. The solution is raising this value in mysql configuration file.

  • If you use xampp in windows, the configuration file is /xampp/mysql/bin/my.ini
  • If you use linux, the configuration file is /etc/mysql/my.cnf

Then find [mysqld] section and change max_allowed_packet to bigger value.

max_allowed_packet = 256M

After you change the value, restart your mysql. It must work now.

Good luck!

Setup RESTful API in Yii2


In this article, I will show you how to setup RESTful API in Yii2 framework. It is a little bit tricky because Yii2 is still in beta release (when this article is written) so the documentation is not complete enough. But don’t worry, this article will give you insight how to setup API in Yii2. Continue reading

Node.js Elastic Beanstalk TIMEDOUT Error


I got an error when deploying my Node.js app into AWS Elastic Beanstalk (EB). The error said

Error: connect ETIMEDOUT
    at errnoException (net.js:901:11)
    at Object.afterConnect [as oncomplete] (net.js:892:19)
    at Protocol._enqueue (/var/app/current/node_modules/mysql/lib/protocol/Protocol.js:110:26)
    at Protocol.handshake (/var/app/current/node_modules/mysql/lib/protocol/Protocol.js:42:41)

My Node.js app using node-mysql module to access database. You can see “mysql” in the error statement. Seeing from errors, this must be related with database. I use Amazon Relational Database Service (RDS) and my node.js app is configured to connect with it.

Continue reading