#!/bin/bash

/opt/mysql/bin/mysqladmin -u root  password 'A123456'

home_dir=$1
mysql -uroot -pA123456<< EOF           


grant all on *.* to 'root'@'localhost' identified by 'A123456';
grant all on *.* to 'root'@'%' identified by 'A123456';
create database  if not exists zabbix default charset utf8;

use zabbix;
source ${home_dir}/files/zabbix-3.2.6/database/mysql/schema.sql;
source ${home_dir}/files/zabbix-3.2.6/database/mysql/images.sql;
source ${home_dir}/files/zabbix-3.2.6/database/mysql/data.sql;

source ${home_dir}/node_ip.sql;
EOF
