How to enable remote access for MySQL

In development world of LAMP, developers need to remote access to MySQL based on IDE such as MySQL Workbench or Navicat because of its beautiful SQL Editor and Result Set.

In order to enable remote access, you need to do as the following:

1) Open port 3306    Go to file /etc/mysql/my.cnf, and remove line bind-address=127.0.0.1

2) Grant permission to username@host
GRANT ALL PRIVILEGES ON *.* TO ‘root’@’%’ IDENTIFIED BY ‘123456’;
FLUSH PRIVILEGES;

If still not OK, just restart MySQL database by: sudo /etc/init.d/mysql restart

Hope you have a good working session.