69 |
AllowOverride None |
AllowOverride None |
70 |
Order allow,deny |
Order allow,deny |
71 |
Allow from $access |
Allow from $access |
72 |
|
diff -Nur smeserver-zabbix-server-0.1.old/root/etc/e-smith/templates/etc/e-smith/sql/init/80zabbix-server smeserver-zabbix-server-0.1/root/etc/e-smith/templates/etc/e-smith/sql/init/80zabbix-server |
73 |
|
--- smeserver-zabbix-server-0.1.old/root/etc/e-smith/templates/etc/e-smith/sql/init/80zabbix-server 2020-05-13 12:16:30.203000000 -0400 |
74 |
|
+++ smeserver-zabbix-server-0.1/root/etc/e-smith/templates/etc/e-smith/sql/init/80zabbix-server 2020-05-13 21:13:00.912000000 -0400 |
75 |
|
@@ -1,6 +1,6 @@ |
76 |
|
{ |
77 |
|
-my $db = ${'zabbix-server'}{'DbName'} || 'zabbix'; |
78 |
|
-my $user = ${'zabbix-server'}{'DbUser'} || 'zabbix'; |
79 |
|
+my $db = ${'zabbix-server'}{'DbName'} || 'zabbixdb'; |
80 |
|
+my $user = ${'zabbix-server'}{'DbUser'} || 'zabbixuser'; |
81 |
|
my $pass = ${'zabbix-server'}{'DbPassword'} || 'secret'; |
82 |
|
|
83 |
|
my $schema = `rpm -qd zabbix-server-mysql | grep create`; |
84 |
|
@@ -9,7 +9,16 @@ |
85 |
|
$OUT .= <<"END"; |
86 |
|
#! /bin/sh |
87 |
|
if [ -d /var/lib/mysql/$db ]; then |
88 |
|
- for P in \$(rpm -qd zabbix-server | grep dbpatch | grep mysql); do |
89 |
|
+ |
90 |
|
+ # check if utf8 |
91 |
|
+ my $curcharset=`echo 'show variables like "character_set_database";'|mysql $db|grep character_set_database|sed -r 's/^character_set_database\\s*([a-zA-Z0-9_-]+)/\\1/'`; |
92 |
|
+ chomp $curcharset; |
93 |
|
+ if ( $curcharset ne "utf8" ) { |
94 |
|
+ echo "ALTER DATABASE DBNAME CHARACTER SET utf8 COLLATE utf8_bin;" |/usr/bin/mysql |
95 |
|
+ echo 'ALTER TABLE `'.$db.'`.`problem_tag` DROP INDEX `problem_tag_1`, ADD INDEX `problem_tag_1` (`eventid`, `tag` (100), `value`(100));' |mysql |
96 |
|
+ mysql --batch --skip-column-names --execute 'select concat("alter table ",TABLE_SCHEMA,".",TABLE_NAME," CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;") from information_schema.TABLES where TABLE_SCHEMA="'.$db.'"' |mysql |
97 |
|
+ } |
98 |
|
+ for P in \$(rpm -qd zabbix-server-mysql | grep dbpatch | grep mysql); do |
99 |
|
/usr/bin/mysql $db < \$P |
100 |
|
done |
101 |
|
else |