EOF
service httpd restart
==============================
#配置数据库
mysql -u root -e "create database zabbix character set utf8 collate utf8_bin;show databases;"
#mysql -u root -e "insert into mysql.user(Host,User,Password) values('localhost','zabbix',password('zabbix'));"
mysql -u root -e "grant all on *.* to admin@'%' identified by 'admin' with grant option;flush privileges;"
mysql -u root -e "grant all on zabbix.* to zabbix@'%' identified by 'zabbix';flush privileges;"
mysql -u root -e "grant all on zabbix.* to zabbix@'127.0.0.1' identified by 'zabbix';flush privileges;"
mysql -u root -e "grant all on zabbix.* to zabbix@'localhost' identified by 'zabbix';flush privileges;"
mysql -u root -e "select user,host,password from mysql.user;flush privileges;"
5.导入数据库。
方法一:首选方法。
updatedb
locate images.sql
cd $(dirname $(locate images.sql))
cd $(dirname $(locate create.sql.gz))
mysql -e "create database zabbix character set utf8 collate utf8_bin;show databases;"
mysql -e "grant all on zabbix.* to zabbix@localhost identified by 'zabbix';"
mysql -e "grant all on *.* to admin identified by 'zabbix' with grant option;"
mysql -e "select user,host,password from mysql.user;flush privileges;"
zcat create.sql.gz | mysql -uroot zabbix
方法二:备选方法。
updatedb
locate images.sql
cd $(dirname $(locate images.sql))
cd $(dirname $(locate create.sql.gz))
mysql -u root -e "create database zabbix character set utf8;show databases;"
mysql -u root zabbix < schema.sql
mysql -u root zabbix < images.sql
mysql -u root zabbix < data.sql
方法三:zabbix-3.2源码包安装时导入数据的方法。
updatedb
locate images.sql
cd $(dirname $(locate images.sql))
cd $(dirname $(locate create.sql.gz))
zcat /usr/share/doc/zabbix-server-mysql-3.2.*/create.sql.gz | mysql -uzabbix -pzabbix zabbix
6、修改zabbix配置文件。
# vi /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=数据库密码
说明:配置文件中只需要修改DB相关的配置就能正常使用了。(金测OK)
Configuration file"/var/www/html/zabbix/conf/zabbix.conf.php"
created: Fail
Unable to create the configuration file.Please install it manually, or fix permissions on the conf directory.
Press the "Download configuration file" button, download the configuration file and save it as"/var/www/html/zabbix/conf/zabbix.conf.php"When done, press the "Retry" button