#修改root数据库密码
mysqladmin -u root password '123456'#创建cacti数据库
mysql -u root -p123456 -e "create database cacti character set utf8mb4 collate utf8mb4_unicode_ci;"#赋予cacti数据库权限和创建cactiuser用户
mysql -u root -p123456 -e "grant all privileges on cacti.* to 'cactiuser'@'localhost' identified by '123456'; "#赋予cactiuser用户数据库填充TimeZoneName权限
mysql -u root -p123456 -e "grant select on mysql.time_zone_name to 'cactiuser'@'localhost' identified by '123456';"#刷新数据库
mysql -u root -p123456 -e "flush privileges;"#cacti的sql导入数据库
mysql -u root -p123456 cacti <"/usr/share/doc/cacti-1.2.15/cacti.sql"#导入数据库后,刷新一下数据库
mysql -u root -p12345