Configure WINDOW10 to remotely connect to a database on a virtual machine (Mysql,redis)

Source: Internet
Author: User
Tags redis server port

/**
* Note that MySQL default is a native connection, if you want to change to LAN access, to modify the settings. Error is (Communications link failure)
* 1, on the server command line input $:vim/etc/mysql/mysql.conf.d/mysqld.cnf
* 2, find bind-address = 127.0.0.1 this line before adding #;
* 3 Restart MySQL service:/etc/init.d/mysql Restart (service mysql restart)
*/

String url = "Jdbc:mysql://192.168.11.130:3306/jdbc_test?usessl=false";
String user = "root";
String password = "123456";
/**
* Use Telnet to connect the host IP 3306 (is not allowed to connect to thisMySQL server)
* Reason: Your account is not allowed to login from remote, only on localhost. This time, as long as the computer in localhost, after logging into MySQL,
* Change "host" in "User" table in "MySQL" Database, rename "%" from "localhost"

#mysql-u root-p Enter password: ... mysql>

Mysql>update User Set host = '% ' where user = ' root ';

Mysql>select host, user from user;


*
* +-----------+------------------+
* | Host | user |
* +-----------+------------------+
*| % | Root |
*| localhost | Debian-sys-maint |
*| localhost | mysql.session |
*| localhost | Mysql.sys |
*+-----------+------------------+
*tips: Note this time to save the exit (flush privileges;)
* Then restart MySQL (/etc/init.d/mysql restart/service mysql restart)
*
*/


The above is a modification to be made on the server

/**
* This time to connect MySQL if still unsuccessful, the server will be reported to reject the connection. Error is
* (Message from server: "Host ' 192.168.11.1 ' isn't allowed to connect to this MySQL server")
* or direct connection is successful.
* This time we're going to open the server's 3306 interface: (note Be sure to turn on the firewall and then open 3306 ports)
* 1, Firewall open 3306 port (sudo ufw allow 3306)
* 2. Turn on Firewall View status: (A, sudo ufw enable B, sudo ufw default deny)
* 3. View firewall status (sudo UFW status)
* OR View port status directly (show global variables like ' port ';)
*
*/

Tips (Tip: You can open the telent of window 10 first

In Control Panel > Programs > (Dropdown page to last) programs and features > turn on and turn off Windows features on the left > turn on telent Service)

Then (win+ R key) can use the telent way to try to spell the server port first.

Configure WINDOW10 to remotely connect to a database on a virtual machine (Mysql,redis)

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.