Get the App
SLTechnology News&Howtos  ›  Database  › 

CactiEZi Chinese version V10.1 is an operating system based on CentOS6.0 system and recompiled by integrating Cacti and other related software.

Shulou Source: shulou.com Published: 2022-06-01 10:01:06 09月14日 Update

Server operating environment:

Operating system: CentOS release 6.8 (Final)

Web server software: Apache/2.2.15 (Unix)

Database system: MySQL 5.1.73

Optimize database security for the default Chinese version of CactiEZi.

Mysql > select host,user,password from user

+-+

| | host | user | password | |

+-+

| | localhost | root |

| | localhost.localdomain | root |

| | 127.0.0.1 | root |

| | localhost |

| | localhost.localdomain |

| | localhost | cactiuser | * 43DD7940383044FBDE5B177730FAD3405BC6DAD7 |

| |% | cactiuser | * 43DD7940383044FBDE5B177730FAD3405BC6DAD7 |

| |% | cacti | * 9CDE1A09ED38FCFD4696D1AA82E4E1EE2F26270D |

+-+

8 rows in set (0.00 sec)

Mysql > select host,db,user from db

+-+

| | host | db | user | |

+-+

| |% | cacti | cacti |

| |% | cacti | cactiuser |

| |% | test | |

| |% | test\ _% | |

| | localhost | cacti | cactiuser | |

+-+

Through the above figure, I want to solve two problems:

1. Log in to the database by default and no password is required. From the above table, we know that the reason is that the root user has not set a password.

The 2.Cacti program connects to the database using the cactiuser user account. Changes are made here to improve the security of the database.

Mysql > update user set password=password ("*") where user= "root"; # change root user password

Query OK, 3 rows affected (0.00 sec)

Rows matched: 3 Changed: 3 Warnings: 0

Mysql > select host,user,password from user

+

| | host | user | password | |

+-+

| | localhost | root | * 1F20AD266C1753F805F6A4A6CDF34C72153C86FB |

| | localhost.localdomain | root | * 1F20AD266C1753F805F6A4A6CDF34C72153C86FB |

| | 127.0.0.1 | root | * 1F20AD266C1753F805F6A4A6CDF34C72153C86FB |

Mysql > flush privileges

Mysql > exit

[root@Cacti /] # mysql-uroot-p # must enter a password to log in to the database

Enter password:

Mysql > use mysql

Mysql > update user set password=password ("* *") where host= "%" and user= "cactiuser"; Query OK, 1 row affected (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 0

# Please note that the password of the host= "%" does not affect the program's connection to the database

Mysql > update user set password=password ("* *") where host= "localhost" and user= "cactiuser"

Query OK, 1 row affected (0.00 sec)

Rows matched: 1 Changed: 1 Warnings: 0

Mysql > flush privileges

Query OK, 0 rows affected (0.00 sec)

# Please note that the host host of the cacti program is localhost, which is effective for changing the password with this item.

Mysql > select host,user,password from user

+-+

| | host | user | password | |

+-+

| | localhost | root | * 1F20AD266C1753F805F6A4A6CDF34C72153C86FB |

| | localhost.localdomain | root | * 1F20AD266C1753F805F6A4A6CDF34C72153C86FB |

| | 127.0.0.1 | root | * 1F20AD266C1753F805F6A4A6CDF34C72153C86FB |

| | localhost |

| | localhost.localdomain |

| | localhost | cactiuser | * 1F20AD266C1753F805F6A4A6CDF34C72153C86FB |

| |% | cactiuser | * 43DD7940383044FBDE5B177730FAD3405BC6DAD7 |

| |% | cacti | * 9CDE1A09ED38FCFD4696D1AA82E4E1EE2F26270D |

The user's password is changed in the database, so the program configuration file also needs to change the corresponding account.

# vi / var/www/html/include/config.php

$database_type = "mysql"

$database_default = "database name"

$database_hostname = "localhost"

$database_username = "user name"

$database_password = "password"

$database_port = "3306"

So far, all configurations have been successful.

It is suggested that root users should be used for the management of the entire database system and that the business system should set up another account.

Tags: Data database password user system program security server account service login configuration operating system Chinese version software Chinese success picture above business two Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker Microsoft Shulou Tech Info Shulou Technology OPPO Reno