Configure remote connection to the MySQL database

Source: Internet
Author: User

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:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.