Sometimes you may get an error from NetBeans that you cannot connect to MySQL even when other applications can. Most likely the fault is in the bind-address setting in my.cnf. To fix this,
  • Open /etc/mysql/my.cnf
  • Comment out the line that reads bind-address = 127.0.0.1 (or localhost or something.
  • Restart MySQL ( $ sudo /etc/init.d/mysql restart )

MySQL - IDE - Java - Linux