Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

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

2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report