use the maintenance account on a debian system #6

Merged
merged 3 commits into from Nov 14, 2011

Projects

None yet

5 participants

@koebi001

No description provided.

@cloos
cloos commented Apr 21, 2011

Instead of these two lines:

$mysqllogin = "-u awk '\$1 ~ /user/ {print \$3}' /etc/mysql/debian.cnf | head -n 1 -pawk '\$1 ~ /password/ {print \$3}' /etc/mysql/debian.cnf | head -n 1";
my $loginstatus = mysqladmin ping $mysqllogin 2>&1;

you should use this one:

my $loginstatus = mysqladmin --defaults-file=/etc/mysql/debian.cnf ping 2>&1;

@koebi001

$mysqllogin needs to be set otherwise I get lots of ERRORs...

@cloos
cloos commented Apr 21, 2011

Ok, just looked to quick on this and missed that $mysqllogin is used later.
But how about this, works fine for me on Ubuntu:

--- mysqltuner.pl.orig  2011-03-07 15:10:13.000000000 +0100
+++ mysqltuner.pl   2011-04-21 10:05:55.367878000 +0200
@@ -289,6 +289,17 @@
            badprint "Attempted to use login credentials from Plesk, but they failed.\n";
            exit 0;
        }
+    } elsif ( -r "/etc/mysql/debian.cnf" and $doremote == 0 ) {
+        # We have a debian maintenance account, use it
+        $mysqllogin = "--defaults-file=/etc/mysql/debian.cnf";
+        my $loginstatus = `mysqladmin $mysqllogin ping 2>&1`;
+        if ($loginstatus =~ /mysqld is alive/) {
+            goodprint "Logged in using credentials from debian maintenance account.\n";
+            return 1;
+        } else {
+            badprint "Attempted to use login credentials from debian maintenance account, but they failed.\n";
+            exit 0;
+        }
    } else {
        # It's not Plesk, we should try a login
        my $loginstatus = `mysqladmin $remotestring ping 2>&1`;
@koebi001

Works also fine for me on debian.

The comment later should get changed:

It's not Plesk, we should try a login

maybe something like:

It's not Plesk or debian, we should try a login

@cloos
cloos commented Apr 21, 2011

You are right.
Are you changing your pull request or create a new one or
will you revoke you pull request so that I cant create a new one?

@koebi001

sorry... git and github is new to me. I had to manually include your patch because git didn't like it.
Hope that now everything is finished.

@wizonesolutions

As a Debian user, I'd like to see this get in. Is the core maintainer still accepting pull requests? Which fork are people using most?

@timstoop

Just noticed this pull request, so you might want to ignore mine (or not). Sorry for the noise!

@major
Owner
major commented Nov 14, 2011

Thanks for this! I've intended to do something like this for a long time but never got around to it. ;)

@major major merged commit 71f14ea into major:master Nov 14, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment