Skip to content

Commit 33d97c6

Browse files
committed
Add DirectAdmin support. Also tested on DirectAdmin v 1.40.3 on Debian 6 - 64 bits #17
1 parent 71f14ea commit 33d97c6

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

mysqltuner.pl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,23 @@ sub mysql_setup {
292292
badprint "Attempted to use login credentials from Plesk, but they failed.\n";
293293
exit 0;
294294
}
295+
} elsif ( -r "/usr/local/directadmin/conf/mysql.conf" and $doremote == 0 ){
296+
# It's a DirectAdmin box, use the available credentials
297+
my $mysqluser=`cat /usr/local/directadmin/conf/mysql.conf | egrep '^user=.*'`;
298+
my $mysqlpass=`cat /usr/local/directadmin/conf/mysql.conf | egrep '^passwd=.*'`;
299+
300+
$mysqluser =~ s/user=//;
301+
$mysqluser =~ s/[\r\n]//;
302+
$mysqlpass =~ s/passwd=//;
303+
$mysqlpass =~ s/[\r\n]//;
304+
305+
$mysqllogin = "-u $mysqluser -p$mysqlpass";
306+
307+
my $loginstatus = `mysqladmin ping $mysqllogin 2>&1`;
308+
unless ($loginstatus =~ /mysqld is alive/) {
309+
badprint "Attempted to use login credentials from DirectAdmin, but they failed.\n";
310+
exit 0;
311+
}
295312
} elsif ( -r "/etc/mysql/debian.cnf" and $doremote == 0 ){
296313
# We have a debian maintenance account, use it
297314
$mysqllogin = "--defaults-file=/etc/mysql/debian.cnf";

0 commit comments

Comments
 (0)