DirectoryIndex index.php Options -Indexes AllowOverride all order deny,allow # deny from all #为了能够远程管理,将默认规则更改为允许所有或者将此项注释 allow from 127.0.0.1 AddType application/x-httpd-php .php php_flag magic_quotes_gpc on php_flag track_vars on
~ 3创建,配置,导入数据库。
mysql> create database cacti; #创建一个库
Query OK, 1 row affected (0.02 sec)
mysql> grant all privileges on cacti.* to 'cactiuser'@'localhost' identified by 'cactiuser'; #创建一个数据cacti数据库用户和密码,并授权可以管理此数据库权限。
Query OK, 0 rows affected (0.00 sec)
特权, 特别待遇, 基本公民权力, 特免
mysql> flush privileges; #激活授权
Query OK, 0 rows affected (0.00 sec)
mysql> show databases; #查看数据库是否建立
+--------------------+
| Database |
+--------------------+
| information_schema |
| auth |
| cacti |
| home |
mysql> use cacti;
Database changed
mysql> show grants for 'cactiuser'@'localhost'; #验证建立的cacti用户权限
+-----------------------------------------------------------------------------------------+
| Grants for cactiuser@localhost |
+-----------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'cactiuser'@'localhost' IDENTIFIED BY PASSWORD '014a3acd285bd3b9' |
| GRANT ALL PRIVILEGES ON `cacti`.* TO 'cactiuser'@'localhost' |
+-----------------------------------------------------------------------------------------+
4更改配置文件
4.1
[root@linux-1 cacti]# vim /var/www/cacti/include/config.php
26 $database_type = "mysql";
27 $database_default = "cacti";
28 $database_hostname = "127.0.0.1"; #将localhost改为了127.0.0.1
29 $database_username = "cactiuser"; #定义使用cacti数据库的用户,可以根据需要更改。
30 $database_password = "cactiuser";#定义使用cacti数据库的用户密码,可以根据需要更改。
31 $database_port = "3306"; #定义数据库的端口,可更改不过要和mysql数据库一致。
更改数据库的用户和密码要和数据库授权的用户保证一致性,此用户和密码必须在建立建立数据库后进行授权。
4.2更改全局配置文件,如需修改方法和上面的配置方法一样。
[root@linux-1 cacti]# vim /var/www/cacti/include/global.php
33 /* Default database settings*/
34 $database_type = "mysql";
35 $database_default = "cacti";
36 $database_hostname = "localhost";
37 $database_username = "cactiuser";
38 $database_password = "cactiuser";
39 $database_port = "3306";
5:导入数据库文件
[root@kjh05 mysql]# mysql -ucactiuser -p cactiuser -hlocalhost cacti use cacti;
Database changed
mysql> show tables; #验证导入信息,相关的表信息已生成
+---------------------------+
| Tables_in_cacti |
+---------------------------+
| cdef |
| cdef_items |
| colors |
| data_input |
6确认cacti 已定制定时服务。
[root@kjh05 mysql]# cat /etc/cron.d/cacti
*/5 * * * * cacti php /var/www/cacti/poller.php &>/dev/null #ok
查看正常后启动httpd服务
Service httpd restart
7浏览验证