[How to Solve ]Error 1130 (HY000) of MySQL authorized connection

ERROR 1130 (HY000): Host ‘Lenovo-PC’ is not allowed to connect to this MySQL server

MySQL Authorization Allowed Connection ERROR 1130 (HY000)

C:\Users\Lenovo>mysql-h10.255.9.79-uroot-p034039
Warning:Usingapasswordonthecommandlineinterfacecanbeinsecure.
ERROR1130(HY000):Host'Lenovo-PC'isnotallowedtoconnecttothisMySQLserver

C:\Users\Lenovo>mysql-hlocalhost-uroot-p034039
Warning:Usingapasswordonthecommandlineinterfacecanbeinsecure.
WelcometotheMySQLmonitor.Commandsendwith;or\g.
YourMySQLconnectionidis54
Serverversion:5.6.21MySQLCommunityServer(GPL)

Copyright(c)2000,2014,Oracleand/oritsaffiliates.Allrightsreserved.

OracleisaregisteredtrademarkofOracleCorporationand/orits
affiliates.Othernamesmaybetrademarksoftheirrespective
owners.

Type'help;'or'\h'forhelp.Type'\c'toclearthecurrentinputstatement.

mysql>

You can see from the above information that when the h parameter is the local IP address, MySQL does not allow the client to connect. Why

Look at the following SQL query:

mysql>usemysql
Databasechanged
mysql>selectuser,hostfromuser;
+------+-----------+
|user|host|
+------+-----------+
|root|127.0.0.1|
|root|::1|
||localhost|
|root|localhost|
+------+-----------+
4rowsinset(0.00sec)

the root user is only allowed to connect on 127.0.0.1 and localhost, but is not allowed to connect using the local IP in LAN

This explains why connections are not allowed

The following is to give root the corresponding login permissions

mysql>GRANTALLPRIVILEGESON*.*TO'root'@'10.255.9.79'IDENTIFIEDBY'034039'WITHGRANTOPTION;
QueryOK,0rowsaffected(0.23sec)

mysql>selectuser,hostfromuser;
+------+-------------+
|user|host|
+------+-------------+
|root|10.255.9.79|
|root|127.0.0.1|
|root|::1|
||localhost|
|root|localhost|
+------+-------------+
5rowsinset(0.00sec)

mysql>

Through this authorization statement

mysql>GRANTALLPRIVILEGESON*.*TO'root'@'10.255.9.79'IDENTIFIEDBY'034039'WITHGRANTOPTION;

it is allowed to use the root user and password 034039 to connect all MySQL databases at the address of 10.255.9.79, and pay the select, insert, update and delete permissions

Finally, refresh the permissions:

mysql>flushprivileges;
QueryOK,0rowsaffected(0.68sec)

OK, this completes the authorization

C:\Users\Lenovo>mysql-h10.255.9.79-uroot-p034039
Warning:Usingapasswordonthecommandlineinterfacecanbeinsecure.
WelcometotheMySQLmonitor.Commandsendwith;or\g.
YourMySQLconnectionidis55
Serverversion:5.6.21MySQLCommunityServer(GPL)

Copyright(c)2000,2014,Oracleand/oritsaffiliates.Allrightsreserved.

OracleisaregisteredtrademarkofOracleCorporationand/orits
affiliates.Othernamesmaybetrademarksoftheirrespective
owners.

Type'help;'or'\h'forhelp.Type'\c'toclearthecurrentinputstatement.

mysql>

Similar Posts: