Configuring remote access for MySQL under Linux

Source: Internet
Author: User
Tags mysql in

Recently, the author of the original virtual machine often down, was forced to the original virtual machine on the project to migrate to a new environment. Install Apache,mysql in the new environment, you need to configure MySQL remote connection after installation.

Because the author of Linux did not learn the system, in the settings of the past made a very serious error, and finally caused the remote IP access to the database, but the local root is not accessible. Note A document in this statement.

The operation of the author was very simple, a total of four steps

(1) Enter MySQL, instruction: mysql-u root-p

(2) using the database, instructions: use MySQL;

(3) Update user table, instruction: Update "" "= '% ' WHERE ' user ' = ' root ' LIMIT 1;

(4) Refresh, instruction: Flush privileges;

In this, the most important step is the third step, the instruction means to update the user table, the user name is the root of the first data in the host to%, and this% represents the Allow other IP access.

The author assumes that% contains all IPs, including localhost. But in fact, the consequence of this is that the other IP can be accessed, but the local root user is no longer accessible.

If you know a little bit about MySQL usage, MySQL's username and password actually have a table stored in MySQL itself, which is located in the user table under MySQL library.

The structure of this table is as follows:

Careful friends will find, usually my root account, in fact, is [email protected], is composed by the host and user two parts, that the third step on the wrong where, wrong in it accidentally removed the permissions of localhost.

SELECT * from user, you can view the data under User, the Reader pro-test.

Temporary work has not been finished, and later give a complete plan.

Configuring remote access for MySQL under Linux

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.