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:
- Solution to the error of MySQL: unrecognized service (CentOS)
- ERROR 1044 (42000): Access denied for user ‘root’@’localhost’
- [Solved] MySQL Connect Error: Can’t connect to MySQL server on ‘ ‘(61)
- [Solved] MYSQL Error: this authentication plugin is not supported
- MySQL Connect Error: Authentication plugin ‘caching_sha2_password’ cannot be loaded
- mysql 1142 – SELECT command denied to user ‘root_ssm’@’localhost’ for table …
- [Solved] MYSQL8 Error: ERROR 2003 (HY000): Can’t connect to MySQL server on ‘localhost’ (10061)
- [Solved] Warning: World-writable config file ‘/etc/my.cnf’ is ignored
- MySQLAccess denied for user ‘root’@’localhost’ [How to Solve]
- mysql Remote connection problems: Lost connection to MySQL server at ‘reading initial communication packet’, syste…