#1045 - Access denied for user 'root'@'localhost' (using password: NO)
Posted by: WoAnerges (80.243.154.---)
Date: April 17, 2008 02:58PM

What should i do now??

Options: ReplyQuote
Re: #1045 - Access denied for user 'root'@'localhost' (using password: NO)
Posted by: stevenmartin99 (---.b-ras1.blp.dublin.eircom.net)
Date: April 17, 2008 03:07PM

#1045 - Access denied for user 'root'@'localhost' (using password: NO)

This is the most common problem people have when trying to open phpmyadmin
reading the sentence above tells me that phpmyadmin is trying to log into mysql using

host - 'localhost'
username - 'root'
password - ''

You may also see 'Access denied for user 'root'@'localhost' (using password: YES)'
all this means is that phpmyadmin is using a password.

mysql checks these values against the values stored for users in its datasbase and in this case they dont match.

phpmyadmin stores its log in values in

C:\wamp\apps\phpmyadmin2.11.5\ and open 'config.inc' or 'config.inc.php'


$cfg['Servers'][$i]['auth_type'] = 'config'; // Authentication method (config, http or cookie based)?
$cfg['Servers'][$i]['user'] = 'root'; // MySQL user
$cfg['Servers'][$i]['password'] = ''; // MySQL password (only needed with 'config' auth_type)

mysql has a default user of root with no password so the phpmyadmin should sign in.

if you have changed your users in mysql then you will need to change them here as well so phpmyadmin can connect to mysql.

Options: ReplyQuote
Re: #1045 - Access denied for user 'root'@'localhost' (using password: NO)
Posted by: WoAnerges (80.243.154.---)
Date: April 17, 2008 03:25PM

so what settings and where i must enter if my site www.cs-masters7.t2.ru
this came on my mail:

Доступ к MySQL:
host: localhost
user: cs-masters7
db: cs-masters7
pass: qwerty

how to config this if i want to upload logs on my site with script

this is the script


#!/usr/bin/perl
#
# $Id: stats.pl 97 2007-04-21 17:49:45Z lifo $
#

# FindBin isn't going to work on systems that run the stats.pl as SETUID
BEGIN {
use strict;
use warnings;

use FindBin;
use lib $FindBin::Bin;
use lib $FindBin::Bin . "/lib";
}

BEGIN { # make sure we're running the minimum version of perl required
my $minver = 5.8;
my $curver = 0.0;
my ($major,$minor,$release) = split(/\./,sprintf("%vd", $^V));
$curver = "$major.$minor";
if ($curver < $minver) {
print "Perl v$major.$minor.$release is too old to run PsychoStats.\n";
print "Minimum version $minver is required. You must upgrade before continuing.\n";
if (lc substr($^O,0,-2) eq "mswin"winking smiley {
print "\nPress ^C or <enter> to exit.\n";
<>;
}
exit 1;
}
}

BEGIN { # do checks for required modules
our %PM_LOADED = ();
my @modules = qw( DBI DBD::mysql );
my @failed_at_life = ();
my %bad_kitty = ();
foreach my $module (@modules) {
my $V = '';
eval "use $module; \$V = \$${module}::VERSION;";
if ($@) { # module not found
push(@failed_at_life, $module);
} else { # module loaded ok; store for later, if -V is used for debugging purposes
$PM_LOADED{$module} = $V;
}
}

# check the version of modules
# DBD::mysql needs to be 3.x at a minimum
if ($PM_LOADED{'DBD::mysql'} and substr($PM_LOADED{'DBD::mysql'},0,1) lt '3') {
$bad_kitty{'DBD::mysql'} = '3.0008';
}

# if anything failed, kill ourselves, life isn't worth living.
if (@failed_at_life or scalar keys %bad_kitty) {
print "PsychoStats failed initialization!\n";
if (@failed_at_life) {
print "The following modules are required and could not be loaded.\n";
print "\t" . join("\n\t", @failed_at_life) . "\n";
print "\n";
} else {
print "The following modules need to be upgraded to the version shown below\n";
print "\t$_ v$bad_kitty{$_} or newer\n" for keys %bad_kitty;
print "\n";
}

if (lc substr($^O,0,-2) eq "mswin"winking smiley { # WINDOWS
print "You can install the modules listed by using the Perl Package Manager.\n";
print "Typing 'ppm' at the Start->Run menu usually will open it up. Enter the module\n";
print "name and have it install. Then rerun PsychoStats.\n";
print "\nPress ^C or <enter> to exit.\n";
<>;
} else { # LINUX
print "You can install the modules listed using either CPAN or if your distro\n";
print "supports it by installing a binary package with your package manager like\n";
print "'yum' (fedora / redhat), 'apt-get' or 'aptitude' (debian).\n";
}
exit 1;
}
}

use Data:grinning smileyumper;
use File:confused smileypec::Functions qw(catfile);
use PS::CmdLine;
use PS:grinning smileyB;
use PS::Config; # use'd here only for the loadfile() function
use PS::ConfigHandler;
use PS::ErrLog;
use PS::Feeder;
use PS::Game;
use util qw( :win compacttime );

# The $VERSION and $PACKAGE_DATE are automatically updated via the packaging script.
our $VERSION = '3.0.8';
our $PACKAGE_DATE = 1202827092;

our $REVISION = ('$Rev: 97 $' =~ /(\d+)/)[0] || '0';

our $DEBUG = 0; # Global DEBUG level
our $DEBUGFILE = undef; # Global debug file to write debug info too
our $ERR; # Global Error handler (PS:grinning smileyebug uses this)
our $DBCONF = {}; # Global database config
our $GRACEFUL_EXIT = 0; #-1; # (used in CATCH_CONTROL_C)

$SIG{INT} = \&CATCH_CONTROL_C;

my ($opt, $dbconf, $db, $conf, $game, $logsource, $feeder, @dodaily);
my $starttime = time;
my $totallogs = 0;

eval { binmode(STDOUT, ":encoding(utf8)"winking smiley; };

$opt = new PS::CmdLine; # Initialize command line paramaters
$DEBUG = $opt->get('debug') || 0; # sets global debugging for ALL CLASSES

# display our version and exit
if ($opt->get('version')) {
print "PsychoStats version $VERSION (rev $REVISION)\n"; # (Perl " . sprintf("%vd", $^V) . "winking smiley\n";
print "Packaged on " . scalar(localtime $PACKAGE_DATE) . "\n";
# print "Author: Jason Morriss <stormtrooper\@psychostats.com>\n";
print "Website: [www.psychostats.com]\n";
print "Perl version " . sprintf("%vd", $^V) . " ($^O)\n";
print "Loaded Modules:\n";
my $len = 1;
foreach my $pm (keys %PM_LOADED) { # get max length first, so we can be pretty
$len = length($pm) if length($pm) > $len;
}
$len += 2;
foreach my $pm (keys %PM_LOADED) {
printf(" %-${len}sv%s\n", $pm, $PM_LOADED{$pm});
}
exit;
}

if (defined(my $df = $opt->get('debugfile'))) {
$df = 'debug.txt' unless $df; # if filename is empty
$DEBUGFILE = $df;
$DEBUG = 1 unless $DEBUG; # force DEBUG on if we're specifying a file
$opt->debug("DEBUG START: " . scalar(localtime) . " (level $DEBUG) File: $DEBUGFILE"winking smiley;
}

# Load the basic stats.cfg for database settings (unless 'noconfig' is specified on the command line)
# The config filename can be specified on the commandline, otherwise stats.cfg is used. If that file
# does not exist then the config is loaded from the __DATA__ block of this file.
$dbconf = {};
if (!$opt->get('noconfig')) {
if ($opt->get('config')) {
PS:grinning smileyebug->debug("Loading DB config from " . $opt->get('config'));
$dbconf = PS::Config->loadfile( $opt->get('config') );
} elsif (-e catfile($FindBin::Bin, 'stats.cfg')) {
PS:grinning smileyebug->debug("Loading DB config from stats.cfg"winking smiley;
$dbconf = PS::Config->loadfile( catfile($FindBin::Bin, 'stats.cfg') );
} else {
PS:grinning smileyebug->debug("Loading DB config from __DATA__"winking smiley;
$dbconf = PS::Config->loadfile( *DATA );
}
} else {
PS:grinning smileyebug->debug("-noconfig specified, No DB config loaded."winking smiley;
}

# Initialize the primary Database object
# Allow command line options to override settings loaded from config
$DBCONF = {
dbtype => $opt->dbtype || $dbconf->{dbtype},
dbhost => $opt->dbhost || $dbconf->{dbhost},
dbport => $opt->dbport || $dbconf->{dbport},
dbname => $opt->dbname || $dbconf->{dbname},
dbuser => $opt->dbuser || $dbconf->{dbuser},
dbpass => $opt->dbpass || $dbconf->{dbpass},
dbtblprefix => $opt->dbtblprefix || $dbconf->{dbtblprefix}
};
$db = PS:grinning smileyB->new($DBCONF);

$conf = new PS::ConfigHandler($opt, $db);
my $total = $conf->load(qw( main ));
$ERR = new PS::ErrLog($conf, $db); # Now all error messages will be logged to the DB

$db->init_tablenames($conf);
$db->init_database;

if (defined $opt->get('reset')) {
my $game = PS::Game->new($conf, $db);
my $res = $opt->get('reset');
my $all = (index($opt->get('reset'),'all') >= 0);
my %del = (
players => ($all || (index($res,'pl') >= 0)),
clans => ($all || (index($res,'cl') >= 0)),
weapons => ($all || (index($res,'we') >= 0)),
);
$game->reset(%del);
exit;
}

$ERR->debug2("$total config settings loaded."winking smiley;
$ERR->fatal("No 'gametype' configured."winking smiley unless $conf->get_main('gametype');
$ERR->info("PsychoStats v$VERSION initialized."winking smiley;

# force 'daily' option if we're trying to calculate a single day award
if (defined $conf->get_opt('award') and $conf->get_opt('start')) {
$opt->set('daily', 'awards');
}

# if -unknown is specified, temporarily enable report_unknown
if ($opt->get('unknown')) {
$conf->set('errlog.report_unknown', 1, 'main');
}

# if a modtype was specified update the config
if (defined $opt->get('modtype') and $conf->getconf('modtype','main') ne $opt->get('modtype')) {
$db->update($db->{t_config}, { value => $opt->get('modtype') }, [ conftype => 'main', section => '', var => 'modtype' ]);
my $oldmod = $conf->getconf('modtype', 'main');
$conf->set('modtype', $opt->get('modtype'), 'main');
$ERR->info("Changing modtype from '$oldmod' to '" . $conf->get_main('modtype') . "' (per command line)"winking smiley;
}

# rescan clantags
if (defined $opt->get('scanclantags')) {
my $all = lc $opt->get('scanclantags') eq 'all' ? 1 : 0;
# remove all current clans and player relationships (profiles remain untouched)
$::ERR->info("Rescanning clantags for ranked players."winking smiley;
if ($all) {
$::ERR->info("Removing ALL player to clan relationships."winking smiley;
$db->query("UPDATE $db->{t_plr} SET clanid=0 WHERE clanid != 0"winking smiley;
$::ERR->info("Deleting all clans (profiles will remain intact)."winking smiley;
$db->query("DELETE FROM $db->{t_clan}"winking smiley;
}

my $total = $db->count($db->{t_plr}, [ allowrank => 1, clanid => 0 ]);
$::ERR->info("$total ranked players will be scanned."winking smiley;

my $game = PS::Game->new($conf, $db);
my $clanid;
my $cur = 1;
my $clans = {};
my $members = 0;
my $plrsth = $db->query("SELECT p.plrid,pp.uniqueid,pp.name FROM $db->{t_plr} p, $db->{t_plr_profile} pp WHERE p.uniqueid=pp.uniqueid and p.allowrank=1 and p.clanid = 0"winking smiley;
while (my ($plrid,$uniqueid,$name) = $plrsth->fetchrow_array) {
$::ERR->verbose(sprintf("%6.2f%% completed.\r", $cur++ / $total * 100), 1);
$clanid = $game->scan_for_clantag($name) || next;
$clans->{$clanid}++;
$members++;
$db->update($db->{t_plr}, { clanid => $clanid }, [ plrid => $plrid ]);
}
$::ERR->verbose(""winking smiley;
$::ERR->info(sprintf("%d clans with %d members found.", scalar keys %$clans, $members));

$opt->set('daily', ($opt->get('daily') || '') . ',clans');
}

# PERFORM DAILY OPERATIONS
# This will exit afterwards (no logs are processed)
DODAILY:
if (my $daily = lc $opt->get('daily')) {
my %valid = map { $_ => 0 } @PS::Game:grinning smileyAILY;
my @badlist = ();
foreach (split(/,/, $daily)) {
if (exists $valid{$_}) {
$valid{$_}++
} else {
push(@badlist, $_) if $_ ne '';
}
}
$ERR->warn("Ignoring invalid daily options: " . join(',', map { "'$_'" } @badlist)) if @badlist;
$daily = join(',', $valid{all} ? @PS::Game:grinning smileyAILY[1..$#PS::Game:grinning smileyAILY] : grep { $valid{$_} } @PS::Game:grinning smileyAILY);

if (!$daily) {
$ERR->fatal("-daily was specified with no valid options. Must have at least one of the following: " . join(',', @PS::Game:grinning smileyAILY), 1);
}
$ERR->info("Daily updates about to be performed: $daily"winking smiley;

$game = PS::Game->new($conf, $db);
foreach (split(/,/, $daily)) {
my $func = "daily_$_";
if ($game->can($func)) {
$game->$func;
} else {
$ERR->warn("Ignoring daily update '$_': No game support"winking smiley;
}
}

&main::exit;
}

# --- Now we can get down to business! Initializing the proper game engine and log feeders
# endless while loop is a place holder for now ...
while (!$opt->get('nologs')) {
$logsource = $conf->get_main('logsource');
if (!defined $logsource) {
$ERR->warn("No logsource defined! Aborting stats update!"winking smiley;
last;
}
$logsource = [ $logsource ] unless ref $logsource; # force it into an array ref

$game = PS::Game->new($conf, $db);
foreach my $source (@$logsource) {
next unless $source; # ignore empty sources
# ignore feeder if it returns undef (undef = specified feeder is not implemented)
$feeder = PS::Feeder->new($source, $game, $conf, $db) || next;

# Let Feeder initialize (read directories, establish remote connections, etc)
my $type = $feeder->init; # the feeder will report any errors that occur
next unless $type;

$conf->setinfo('stats.lastupdate', time) unless $conf->get_info('stats.lastupdate');
$totallogs += $game->process_feed($feeder);
$conf->setinfo('stats.lastupdate', time);

$feeder->done;

&main::exit if $GRACEFUL_EXIT > 0;
}
&main::exit if $GRACEFUL_EXIT > 0;

# If we're running as a daemon then we loop,
# otherwise we exit after a single iteration of the loop
# a proper 'daemonize' function has not been added yet
if ($opt->get('daemon')) { # only accept 'daemon' from the command line, not the config
sleep(5); # sleep for a bit before we loop again
} else {
last;
}
}

# check for auto.update_* options
foreach my $v (@PS::Game:grinning smileyAILY) {
my $lastupdate = $conf->getinfo("daily_$v.lastupdate"winking smiley || 0;
my $when = $conf->get_main("auto.update_$v"winking smiley;
next unless $when;
my $offset = (time - $lastupdate) / 60; # number of minutes since last update
if ($lastupdate) {
push(@dodaily, $v) if
($when eq 'all') ||
($when eq 'hourly' and $offset >= 60) ||
($when eq 'daily' and $offset >= 60*24) ||
($when eq 'weekly' and $offset >= 60*24*6) ||
($when eq 'monthly' and $offset >= 60*24*28);
} else {
push(@dodaily, $v);
}
}
if (@dodaily) {
$opt->set('daily', join(',',@dodaily));
# print $opt->get('daily'),"\n";
goto DODAILY;
}

# PS::ErrLog points to this to actually exit on a fatal error, incase I need to do some cleanup
sub main::exit {
# <> if iswindows();
CORE::exit(@_)
}

END {
$ERR->info("PsychoStats v$VERSION exiting (elapsed: " . compacttime(time-$starttime) . "; logs: $totallogs)"winking smiley if defined $ERR;
$opt->debug("DEBUG END: " . scalar(localtime) . " (level $DEBUG) File: $DEBUGFILE"winking smiley if $DEBUGFILE and defined $opt;
}


sub CATCH_CONTROL_C {
$GRACEFUL_EXIT++;
if ($GRACEFUL_EXIT == 0) { # WONT HAPPEN (GRACEFUL_EXIT defaults to 0 now)
if ($opt->get('daemon')) {
$GRACEFUL_EXIT++;
goto C_HERE;
}
syswrite(STDERR, "Caught ^C -- Are you sure? One more will attempt a gracefull exit.\n"winking smiley;
} elsif ($GRACEFUL_EXIT == 1) {
C_HERE:
syswrite(STDERR, "Caught ^C -- Please wait while I try to exit gracefully.\n"winking smiley;
} else {
syswrite(STDERR, "Caught ^C -- Alright! I'm done!!! (some data may have been lost)\n"winking smiley;
&main::exit;
}
$SIG{INT} = \&CATCH_CONTROL_C;
}

__DATA__

# If no stats.cfg exists then this config is loaded instead

dbtype = mysql
dbhost = localhost
dbport =
dbname = psychostats
dbuser =
dbpass =
dbtblprefix = ps_

Options: ReplyQuote
Re: #1045 - Access denied for user 'root'@'localhost' (using password: NO)
Posted by: stevenmartin99 (---.b-ras1.blp.dublin.eircom.net)
Date: April 17, 2008 03:29PM

this is PERL


WAMP only comes with php


you wont get this working

Options: ReplyQuote
Re: #1045 - Access denied for user 'root'@'localhost' (using password: NO)
Posted by: WoAnerges (80.243.154.---)
Date: April 17, 2008 03:35PM

but i need! how do i get this to work??? im lamer i dont know how to make this work. sad smiley
please can anyone help!!!!

Options: ReplyQuote
Re: #1045 - Access denied for user 'root'@'localhost' (using password: NO)
Posted by: S3NATOR (---.sip.mem.bellsouth.net)
Date: April 17, 2008 03:39PM

stevenmartin99 Wrote:
-------------------------------------------------------
> #1045 - Access denied for user 'root'@'localhost'
> (using password: NO)
>
> This is the most common problem people have when
> trying to open phpmyadmin
> reading the sentence above tells me that
> phpmyadmin is trying to log into mysql using
>
> host - 'localhost'
> username - 'root'
> password - ''
>
> You may also see 'Access denied for user
> 'root'@'localhost' (using password: YES)'
> all this means is that phpmyadmin is using a
> password.
>
> mysql checks these values against the values
> stored for users in its datasbase and in this case
> they dont match.
>
> phpmyadmin stores its log in values in
>
> C:\wamp\apps\phpmyadmin2.11.5\ and open
> 'config.inc' or 'config.inc.php'
>
>
> $cfg['Servers'][$i]['auth_type'] = 'config';
> // Authentication method (config, http or cookie
> based)?
> $cfg['Servers'][$i]['user'] = 'root';
> // MySQL user
> $cfg['Servers'][$i]['password'] = '';
> // MySQL password (only needed with 'config'
> auth_type)
>
> mysql has a default user of root with no password
> so the phpmyadmin should sign in.
>
> if you have changed your users in mysql then you
> will need to change them here as well so
> phpmyadmin can connect to mysql.


Sorry if I should have made a new post about this but I'm havening the same exact error. I'm also a bit of a n00b. I figured out how to set a password for phpAdmin (in the config.inc.php) and I can login to phpadmin using root and a password on localhost. But when I set this password for root it disallows access to my forums from localhost. When I setup my phpBB 3.0.1 forums I did not have a root password set. Now that I have one set I get the #1045 Access denied for user 'root' error when I try to access my forums. Please help.

I have the latest WampServer2 package so my versions are:
Apache 2.2.8
PHP 5.2.5 + PECL
MySQL 5.0.51a


Thanks,
S3N

Options: ReplyQuote
Re: #1045 - Access denied for user 'root'@'localhost' (using password: NO)
Posted by: stevenmartin99 (---.b-ras1.blp.dublin.eircom.net)
Date: April 17, 2008 03:53PM

no... phpbb has its own config file with host name and passowrd.. make sure u have a user setup in mysql for this.. if you dunno if u do..

open phpmyadmin.. select privleges and u will see a list of users.. make sure phpbbs user and password is set there., if not add them --- altho i think phpbb use a encrtyed pw..

Options: ReplyQuote
Re: #1045 - Access denied for user 'root'@'localhost' (using password: NO)
Posted by: S3NATOR (---.sip.mem.bellsouth.net)
Date: April 17, 2008 04:34PM

stevenmartin99 Wrote:
-------------------------------------------------------
> no... phpbb has its own config file with host
> name and passowrd.. make sure u have a user
> setup in mysql for this.. if you dunno if u
> do..
>
> open phpmyadmin.. select privleges and u will see
> a list of users.. make sure phpbbs user and
> password is set there., if not add them ---
> altho i think phpbb use a encrtyed pw..
Ok, root already had access to the phpbb database but I added another username to the database. Now is there something I need to configure in phpbb3?

Options: ReplyQuote
Re: #1045 - Access denied for user 'root'@'localhost' (using password: NO)
Posted by: yfastud (Moderator)
Date: April 17, 2008 04:38PM

As Steven pointed out, user "root" is for main db and control everything; for every new application or user, you should creat new db account for it, and if you don't mind to follow the guides, these links below would help you out

Setup Password guide:

[guides.jlbn.net]

Setup Database:

[guides.jlbn.net]

Setup phpBB3:

[guides.jlbn.net]

Have fun,

FREE One A Day
FREE Photo
FREE Games
FREE Websites
FREE Portable GPS
FREE WAMP Guides

Options: ReplyQuote
Re: #1045 - Access denied for user 'root'@'localhost' (using password: NO)
Posted by: S3NATOR (---.sip.mem.bellsouth.net)
Date: April 17, 2008 04:59PM

Thanks yfastud and stevenmartin99. I actually used yfastud's password guide to set my root password. The problem is that when I setup phpBB3 I didn't have a password set. So phpBB3 is using root with no password. I setup a new username like stevenmartin99 said but now I'm guessing I need to configure phpBB3 to use my new username/password. How do I do this?

Thanks,
S3N

Options: ReplyQuote
Re: #1045 - Access denied for user 'root'@'localhost' (using password: NO)
Posted by: yfastud (Moderator)
Date: April 17, 2008 05:10PM

Already posted, you should setup new db account w/ user and pass for it, and of course if you dont mind to follow my guides Setup Database and Setup phpBB

Have fun,

FREE One A Day
FREE Photo
FREE Games
FREE Websites
FREE Portable GPS
FREE WAMP Guides

Options: ReplyQuote
Re: #1045 - Access denied for user 'root'@'localhost' (using password: NO)
Posted by: S3NATOR (---.sip.mem.bellsouth.net)
Date: April 17, 2008 05:19PM

OK, I figured it out. I had to change the username/password in phpBB3\config.php to my newly created username/password. Now I can access my forums. Thanks guys! Sorry that this kinda took over this topic.

S3N

Options: ReplyQuote
Re: #1045 - Access denied for user 'root'@'localhost' (using password: NO)
Posted by: yfastud (Moderator)
Date: April 17, 2008 05:54PM

Yep, you can make it work that way but it's not a good habit to use user root for every new app and that's why I suggested you to make new db acc for it

Have fun,

FREE One A Day
FREE Photo
FREE Games
FREE Websites
FREE Portable GPS
FREE WAMP Guides

Options: ReplyQuote
Re: #1045 - Access denied for user 'root'@'localhost' (using password: NO)
Posted by: S3NATOR (---.sip.mem.bellsouth.net)
Date: April 17, 2008 08:01PM

yfastud Wrote:
-------------------------------------------------------
> Yep, you can make it work that way but it's not a
> good habit to use user root for every new app and
> that's why I suggested you to make new db acc for
> it
I took you and steve's advice and created a different username/password for this database instead of using root. Thanks again.

Also, yfastud your guides are awesome. Keep up the good work.

S3N

Options: ReplyQuote
Re: #1045 - Access denied for user 'root'@'localhost' (using password: NO)
Posted by: yfastud (Moderator)
Date: April 17, 2008 09:25PM


Options: ReplyQuote


Sorry, only registered users may post in this forum.