Reasons for resolving the problem of remote connection MySQL failure

Source: Internet
Author: User

In the CentOS environment, after installing MySQL, root password is empty, need to set a password to use, set the password method as follows:

/usr/bin/mysqladmin-u Root Password yourpasswd

Note to replace the above command yourpasswd with their own password, this time if you use the following command to successfully log on to the MySQL terminal, the password setting is successful:

Mysql-u root-p

At this point, when you connect to MySQL remotely, you will be prompted to view the user table of the system table, and you can find that users have access only from localhost:

Mysql> Select host from user;+-----------+| Host      |+-----------+| localhost |+-----------+

The "%" in host represents the remote access permission, and the following command is used to add

GRANT all privileges on * * to ' root ' @ '% ' identified by ' yourpasswd ' with GRANT OPTION;

Then the remote connection should be OK, if this time there are problems, it is likely to be a firewall problem, close iptables and so can be resolved.

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.