[Comment 1]
The former colleague penguin said that he installed MySQL 5.5 and reported the error 1042-can't get hostname for your address when using the mysql client for remote connection, however, the permission has been granted and the grant is successful.
This error indicates that "your address cannot obtain the host name ".Skip-name-resolveParameters.
Official documentation:
--skip-name-resolve
Use IP addresses rather than host names when creating grant table entries. This option can be useful if your DNS does not work.
--skip-name-resolve
Do not resolve host names when checking client connections. Use Only IP numbers. If you use this option, all
HostColumn values in the grant tables must be IP numbers or
localhost. See
Section 7.7.11, "how MySQL uses DNS ".
Mysql> show variables like '% skip_name_resolve % ';
+ ----------------- + ------- +
| Variable_name | value |
+ ----------------- + ------- +
| Skip_name_resolve | on |
+ ----------------- + ------- +
1 row in SET (0.00 Sec)
Mysql> set global skip_name_resolve = 0;
Error 1238 (hy000): Variable 'skip_name_resolve' is a read only variable
Mysql>
Failed. It seems that only my. CNF has been modified.
Modify under the [mysqld] Node
Skip-name-resolve
# Ignore host name access
Lower_case_table_names = 1
# Ignore case sensitivity of database tables
Restart mysqld process.
[Comment 2]
Former colleague Penguin:
Mysql-H 192.168.1.101-u root-P
My local mysql.192.168.1.101 is a local IP address.
Grant all privileges on *. *
'Hive' @ '192. 168.1.101 'identified by 'hive' with grant option; this means that the connection fails and the permission is incorrect. How can this problem be solved.
View official documents:
hostname
Variable name |
hostname |
Variable Scope |
Global |
Dynamic variable |
No |
|
Permitted values |
Type |
string |
The server sets this variable to the server host name at startup.
mysql> show variables like '%hostname%';
+---------------+-------------------------------------------+
| Variable_name | Value |
+---------------+-------------------------------------------+
| hostname | xxxxx.china.online.xx.com |
+---------------+-------------------------------------------+
1 row in set (0.00 sec)
mysql> set global hostname='xxxxx2.china.online.xx.com';
ERROR 1238 (HY000): Variable 'hostname' is a read only variable
mysql>
Failed. Only my. CNF is modified. Under the mysqld Option
[Mysqld]
# Comment out the parameter. MySQL cannot access the database directly using the local IP address.
# Hostname
Restart the mysqld service.