MySQL enables remote connection and mysql enables

Source: Internet
Author: User

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.

 

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.