Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

use the maintenance account on a debian system #6

Merged
merged 3 commits into from

5 participants

@koebi001

No description provided.

@cloos

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

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

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

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 20, 2011
  1. @koebi001
Commits on Apr 21, 2011
  1. @koebi001
  2. @koebi001
This page is out of date. Refresh to see the latest.
Showing with 12 additions and 1 deletion.
  1. +12 −1 mysqltuner.pl
View
13 mysqltuner.pl
@@ -292,8 +292,19 @@ sub mysql_setup {
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
+ # It's not Plesk or debian, we should try a login
my $loginstatus = `mysqladmin $remotestring ping 2>&1`;
if ($loginstatus =~ /mysqld is alive/) {
# Login went just fine
Something went wrong with that request. Please try again.