MySQL enables remote connection and mysql enables
The basic syntax for enabling MySQL is grant authorization, which is usually not a problem. It is mainly because it may not be connected after it is enabled.
Grant all privileges on Database Name. table name TO username @ 'IP address' identified by 'Password' with grant option; flush rivileges; example: grant all privileges on *. * TO temp @ '%' identified by 'temp123' with grant option; authorize all servers TO use the username temp and password temp123 TO connect all tables in all databases for all operations TO increase throughput, query, and modify
The following error message may appear:
After successful authorization is confirmed (check the method at the bottom of the article), the following problems may occur: Firewall problems, and MySQL configuration is bound to local 127.0.0.1.
I. Firewall Problems
The firewall does not enable port 3306, causing remote connection failure.
1 open firewall port 2 add Port 3/sbin/iptables-I INPUT-p tcp -- dport 3306-j ACCEPT 4 5 Save settings 6/etc/init. d/iptables save 7 8 view status 9/etc/init. d/iptables status10 11 temporarily disable Firewall service 12 service iptables stop13 14 Enable Firewall service 15 service iptables start16 17 start up no longer Firewall service 18 chkconfig iptables off
Ii. Bind a local IP Address
MySQL is bound to the IP address of the local 127.0.0.1 instance.
This can be viewed using commands, as shown in figure
Modify the my. cnf configuration file and add it in line: 43 # comment the statement
Restart MySQL to take effect
Check whether the authorized user is successfully created.
The authorized user saves the user table in the MySQL database of mysql to view the table data.
use mysql;select Host,User from user\G;
Host % indicates all servers
127.0.0.1, localhost is the local server.
You can also use select * to view other specific permissions, including adding, deleting, modifying, and querying permissions.