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

1k views Asked by At

I have seen so many solutions to this problem but I really feel my experience is unique (I wish it wasn't though.. in the past I had no issue with this, but I am now using the latest Fedora (23) and I believe the latest version of mySQL

so basically I was going to start a new sql server and start to import old databases, the problem is I cannot log into the sql server because its asking me for a password right from the get go.

So ... using 127.0.0.1/phpmyadmin certainly gives me the login, but all attempts to get in fail. Interestingly enough 127.0.0.1/phpmyadmin/setup will let me in and when I configure a database (giving it a login and password) those don't work after moving the file config.inc.php .. back a directory AND removing the folder "config". I even try editing the file "config.inc.php" and see what the login name and password is yet STILL it does not let me in.

I'm rebooting the computer, I am running "service httpd restart" between each try ... I cannot get in. Just keeps giving me the same error "

My only assumption is (perhaps) I may have moved a database file that I shouldn't have (from the old to the new), but I'm not 100% sure where they are stored. I assume though it should not be an issue if I am creating a new one though, right? Also (perhaps) I am not moving "config.inc.php" to the right place, perhaps? I am totally lost.

in /var/lib/phpMyAdmin

used to have a config folder (deleted it as instructed after moving config.inc.php back to /var/lib/phpMyAdmin

now I have config.inc.php which looks like the following:

<?php
/*
 * Generated configuration file
 * Generated by: phpMyAdmin 4.5.3.1 setup script
 * Date: Mon, 04 Jan 2016 20:15:07 +0000
 */

/* Servers configuration */
$i = 0;

/* Server: localhost [1] */
$i++;
$cfg['Servers'][$i]['verbose'] = '';
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['port'] = '';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'root';

/* End of servers configuration */

$cfg['DefaultLang'] = 'en';
$cfg['blowfish_secret'] = '568acf795d62d3.18588477';
$cfg['ServerDefault'] = 1;
$cfg['UploadDir'] = '';
$cfg['SaveDir'] = '';
?>

Additional Details: I tried root w/no password also (no access) Also tried: "mysql -u root password root" and that does not work wither

2

There are 2 answers

1
Chase Cromwell On

Having had this problem before, what fixed it for me was accessing the "phpmyadmin" page from another link. Go to localhost/phpmyadmin instead of using 127.0.0.1/phpmyadmin

0
jabbyjim On

so my answer was found on the MYSQL site.

Apparently there is a temporary password that is produced when you begin.

it can be found doing a ..

[root@Gretchen ~]# grep 'temporary password' /var/log/mysqld.log

which is so weird but it gave me the password and it worked. More security I guess. I can see this throwing off people who have used mysql before without having to jump through that hoop.