The iMC failed to manage the mysql database.

2022-06-21 19:57:49 Published
  • 0 Followed
  • 0Collected ,1198Browsed

Network Topology

irrelevant

Problem Description

In ysql8.0.27, monitoring cannot be added through apm, and a database connection error is reported. You can connect from the database server background, but cannot connect to the database from other terminals.

Process Analysis

After installing the locally deployed imc+mysql according to the manual, the permission to log in to the database remotely is restricted, and only the local root user can log in to mysql.


[root@centos log]# mysql -u root -pxxx        (xxx means the psw)

mysql: [Warning] Using a password on the command line interface can be insecure.

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 5301

Server version: 8.0.27 MySQL Community Server - GPL

 

Copyright (c) 2000, 2021, Oracle and/or its affiliates.

 

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>

mysql>

mysql> use mysql;

Database changed

mysql> select host,user from user;

+-----------+------------------+

| host      | user             |

+-----------+------------------+

| %         | ead              |

| %         | imc_aclm         |

| %         | imc_apm_config   |

| %         | imc_apme         |

| %         | imc_bsm          |

| %         | imc_cmdb_new     |

| %         | imc_config       |

| %         | imc_icc          |

| %         | imc_inventory    |

| %         | imc_monitor      |

| %         | imc_perf         |

| %         | imc_ssa          |

| %         | imc_syslog       |

| %         | imc_vlan         |

| %         | imc_vnm          |

| %         | report           |

| %         | reportplat       |

| localhost | mysql.infoschema |

| localhost | mysql.session    |

| localhost | mysql.sys        |

| localhost | root             |

+-----------+------------------+

21 rows in set (0.00 sec)

The permission for querying the root account is only localhost. % indicates all accounts.


Solution

1.Remove account restrictions and release the remote login authority of the account.

mysql> update user set host='%' where user='root';

Query OK, 1 row affected (0.00 sec)

Rows matched: 1  Changed: 1  Warnings: 0

 

mysql> select host,user from user;

+-----------+------------------+

| host      | user             |

+-----------+------------------+

| %         | ead              |

| %         | imc_aclm         |

| %         | imc_apm_config   |

| %         | imc_apme         |

| %         | imc_bsm          |

| %         | imc_cmdb_new     |

| %         | imc_config       |

| %         | imc_icc          |

| %         | imc_inventory    |

| %         | imc_monitor      |

| %         | imc_perf         |

| %         | imc_ssa          |

| %         | imc_syslog       |

| %         | imc_vlan         |

| %         | imc_vnm          |

| %         | report           |

| %         | reportplat       |

| %         | root             |

| localhost | mysql.infoschema |

| localhost | mysql.session    |

| localhost | mysql.sys        |

+-----------+------------------+

21 rows in set (0.00 sec)

 

mysql> alter user 'root'@'%' identified with mysql_native_password by 'iMC_123456';

Query OK, 0 rows affected (0.00 sec)

 

mysql> grant all privileges on *.* to root@'%' with grant option;

Query OK, 0 rows affected (0.00 sec)

 

mysql> flush privileges;

Query OK, 0 rows affected (0.00 sec)

Please rate this case:   
1 Comments

Add Comments: