By default, Mysql cannot be accessed through a remote machine. You can enable remote access through the following configuration.
My Mysql environment is ubuntu + mysql5
1. Modify/etc/mysql/my. conf, bind-address, and specify as the actual IP address of the Local Machine. After modifying your my. con, it looks like the following:
[Mysqld]
#
# * Basic Settings
#
Default-character-set = utf8
Default-storage-engine = INNODB
Bind-address = 192.168.1.107
User = mysql
Pid-file =/var/run/mysqld. pid
Socket =/var/run/mysqld. sock
Port = 3306
Basedir =/usr
Datadir =/var/lib/mysql
Tmpdir =/tmp
Language =/usr/share/mysql/english
Skip-external-locking
2. log on to mysql using root and execute the following command:
Grant all on sonardb. * to sonar @ '%' identified by '123 ';
Grant all on sonardb. * to sonar @ localhost identified by '20140901 ';
Sonardb replaces the name of the database you want to access. sonar is the username you want to use, and 123456 is replaced with your password. This enables remote access.