One, in the virtual machine operating
1, check the firewall status
Firewall - CMD - state
2, if it's running status, then close the firewall
Systemctl stop firewalld. Service
3, login mysql
Mysql -u root -p password
4, use mysql; Check the users table:
The SELECT ` Host `, ` User ` FROM the User;
5, update user table:
UPDATE the user SET ` Host `='%' WHERE ` user `='root' LIMIT 1;
6, forced to refresh the permissions:
Flush privileges;
7, exit
exit;
8, if appear, error number 2003 Cant connect to MySQL server on 192.168.125.128 10060
In a virtual machine 192.168.125.128, execute the following command:
Iptables -i INPUT -j ACCEPT -p TCP - 0/0 - dport 3306 s
Second, in the real machine
1, return to navicate, input current virtual machine IP address as the server
2, the mysql password, test the connection