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