The Ubuntu virtual machine is installed in the VirtualBox and then the MySQL Community server (GPL)in Ubuntu, version 5.7.18, wants to connect to MySQL server from outside (host).
Because the network mode of the Ubuntu virtual machine is "NAT Network", first map the host's 3306 port to the 3306 port of Ubuntu virtual machine in VirtualBox;
Then installed in the host MySQL Workbench, with root login MySQL server is unsuccessful, view the online solution, found that need to modify two places in Ubuntu virtual machine:
- Comment out or modify the bind_address line in/etc/mysql/my.cnf to "bind_address=0.0.0.0":
On my system,bind_address is not in the/etc/mysql/my.cnf file , this file removes the comment only the following two lines of content:
!includedir/etc/mysql/conf.d/
!includedir/etc/mysql/mysql.conf.d/
Based on this content, you should look at the. cnf file in both/etc/mysql/conf.d/and/etc/mysql/mysql.conf.d/folders, and Discover/etc/mysql/mysql.conf.d/ The mysqld.cnf file is configured with "bind_address=127.0.0.1" and commented out.
(if this item is not set, MySQL Workbench indicates that the connection was unsuccessful:)
- the host domain of the relevant user (for example, root) in the Mysql.user table can be modified to a specific IP address, or "%" as a wildcard (for example, "%" on behalf of any address):UPDATE user SET host= '% ' WHERE User= ' root '.
(if this item is not set, MySQL Workbench prompt Access Denied:)
Also, if you add "bind_address=0.0.0.0" directly to the/etc/mysql/my.cnf file, the bind_address in the/etc/mysql/will be overwritten, depending on the comment in the file and its existing content. The bind_address in the etc/mysql/my.cnf file.
Reference: http://www.linuxidc.com/Linux/2017-04/143203.htm
MySQL 5.7 Remote Connection