MySQL 5.7 Remote Connection

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.