For the solution of the virtual machine Linux side MySQL database can not be remote access one of the following content I have to organize two solutions, the details are as follows:
Workaround One:
1, in the console execution Mysql-u root-p mysql,centos system prompts to enter the database root user's password, the input completes then enters the MySQL console
2. Execute GRANT all privileges in MySQL console *.* to ' root ' @ '% ' identified by ' MyPassword ' with Grant OPTION; FLUSH privileges;
3, in the MySQL Console Executive command of the ' root ' @ '% ' can be understood in this way: root is the user name,% is the host name or IP address, where the% represents any host or IP address, you can also replace any other user name or specify a unique IP address; ' MyPassword ' is the password for the login database specified by the authorized user; and what I need to say is that I'm here to authorize all permissions to specify partial rights
4, switch to root user to open Iptables profile: vi/etc/sysconfig/iptables
Add Red Font
# Firewall configuration written by System-config-firewall
# Manual Customization to this file is not recommended.
*filter
: INPUT ACCEPT [0:0]
: FORWARD ACCEPT [0:0]
: OUTPUT ACCEPT [0:0]
-A input-m State--state Establi Shed,related-j ACCEPT
-a input-p icmp-j ACCEPT-a
input-i lo-j ACCEPT
-a input-m state--state new-m TC P-p TCP--dport 22-j ACCEPT
-a input-m state--state new-m tcp-p TCP--dport 3306-j ACCEPT
-a input-j REJ ECT--reject-with icmp-host-prohibited
-A forward-j reject--reject-with icmp-host-prohibited
COMMIT
Restart iptables:service iptables restart after all modifications are completed
You can verify that the rules are in effect:iptables-l this way ,
We have completed the CentOS firewall settings modification.
In remote: mysql-h 192.168.16.128-u root2-p Enter password Root2 success ~
Workaround Two:
For details, please see the following code:
Mysql-uroot-p
Enter Password:
mysql>grant all privileges on *.* to ' root ' @ '% ' identified by ' sy31214 ' with GR ANT OPTION;
Mysql>flush privileges;
The above is the entire content of this article, for the virtual machine Linux MySQL database can not be remote access to the solution there are many kinds of, welcome you to share their own master of the solution, this article is not good, look at a lot of suggestions for criticism.