Mysql cannot be accessed through remote machines by default. Remote access can be enabled through the following configuration.
My MySQL environment is ubuntu+mysql5
1. Modify /etc/mysql/my.conf, modify bind-address, and specify it as the actual IP address of the machine. After modification, your my.con will probably look like the following
[mysqld]
# .1.107
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
language = /usr/share/mysql/english
skip-external-locking
2. Log in to mysql as root and execute the following command
grant all on sonardb.* to sonar @'%' identified by '123456';
grant all on sonardb.* to sonar@localhost identified by '123456';
Replace sonardb with the database name you want to access, sonar is the user name you want to use, and replace 123456 with your Password, thus enabling the remote access function.