Sonntag, 2. Januar 2011

Print out MySQL root password

If you have forgotton your MySQL root password but you are using IspCP, you got luck. Create the following pearl script in the folder /var/www/ispcp/engine

#!/usr/bin/perl

use FindBin;
use lib "$FindBin::Bin/";
require 'ispcp_common_code.pl';
use strict;
use warnings;

my ($rs, $rdata) = (undef, undef);

my $current_db_pass = undef ;

if(exists  $main::cfg{'DATABASE_PASSWORD'} && $main::cfg{'DATABASE_PASSWORD'}) {
    $current_db_pass = $main::cfg{'DATABASE_PASSWORD'};
} else {
    $current_db_pass = '';
}


($rs, $current_db_pass) = decrypt_db_password($current_db_pass);   

print STDOUT $current_db_pass;

Make the file executable and run it. It will print out your root password. Please not that this only prints the password stored encrypted in the ispcp settings.

Keine Kommentare: