Configure remote connection to the MySQL database
When mysql remote connection software (MySQL-Front) is used, the following error occurs during remote connection:
[Root @ master ~] # Mysql-u root @ localhost
Welcome to the MySQL monitor. Commands end with; or \ g.
Your MySQL connection id is 8
Server version: 5.1.66 Source distribution
Copyright (c) 2000,201 2, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
Affiliates. Other names may be trademarks of their respective
Owners.
Type 'help; 'or' \ H' for help. type' \ C' to clear the current input statement.
Mysql> quit
Solve remote connection failure:
[Root @ master ~] # Mysql-u root-p
Enter password:
Welcome to the MySQL monitor. Commands end with; or \ g.
Your MySQL connection id is 11
Server version: 5.1.66 Source distribution
Copyright (c) 2000,201 2, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
Affiliates. Other names may be trademarks of their respective
Owners.
Type 'help; 'or' \ H' for help. type' \ C' to clear the current input statement.
Mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with-
Database changed
Mysql> select user, password, host from user;
-- Add the IP address for remote access to the host
+ ------ + ------------------------------------------- + ----------------- +
| User | password | host |
+ ------ + ------------------------------------------- + ----------------- +
| Root | * 81F5E21E35407D884A6CD4A731AEBFB6AF209E1B | localhost |
| Root | * D997577481B722A2996B58BCE11EF3C312AC0B89 | master. cloudera |
| Root | 127.0.0.1 |
| Localhost |
| Master. cloudera |
+ ------ + ------------------------------------------- + ----------------- +
5 rows in set (0.00 sec)
Mysql> grant all privileges on *. * to root @ "10.53.105.221" identified by "root ";
-- Assign the IP address 10.53.105.221 to the host with all permissions (including remote access and remote operation permissions)
Query OK, 0 rows affected (0.04 sec)
Mysql> flush privileges;
-- Reload permission settings
Query OK, 0 rows affected (0.05 sec)
Mysql> select user, password, host from user;
-- Query again. The IP address 10.53.105.221 host has been added to the host file.
+ ------ + ------------------------------------------- + ----------------- +
| User | password | host |
+ ------ + ------------------------------------------- + ----------------- +
| Root | * 81F5E21E35407D884A6CD4A731AEBFB6AF209E1B | localhost |
| Root | * D997577481B722A2996B58BCE11EF3C312AC0B89 | master. cloudera |
| Root | 127.0.0.1 |
| Localhost |
| Master. cloudera |
| Root | * 81F5E21E35407D884A6CD4A731AEBFB6AF209E1B | 10.53.105.221 |
+ ------ + ------------------------------------------- + ----------------- +
6 rows in set (0.00 sec)
Remote login again, successfully connected, such: