17

Wanted to get started with Ruby on Rails so I installed instant rails and set up a mysql password. Problem is now I can't get access to phpmyadmin.

From the rails control panel, when I go to configure >> database (via PhpMyadmin) it opens up phpmyadmin with the message

Error

MySQL said: Documentation
#1045 - Access denied for user 'root'@'localhost' (using password:

NO)

When I used to use XAMPP after setting a password instead of taking me directly within phpmyadmin (as it did without a password) it took me to the login screen instead. With instant rails that's not the case. Anyone had this problem when they first set a mysql password and using the instant rails package?

OMG Ponies
  • 300,587
  • 73
  • 490
  • 482
Derek
  • 171
  • 1
  • 1
  • 3

14 Answers14

28

Edit your phpmyadmin config.inc.php file :

Path For Config Page is wamp\apps\phpmyadmin3.4.5\config.inc.php

$cfg['Servers'][$i]['verbose'] = 'localhost';

$cfg['Servers'][$i]['host'] = 'localhost';

$cfg['Servers'][$i]['port'] = '3306';

$cfg['Servers'][$i]['socket'] = '';

$cfg['Servers'][$i]['connect_type'] = 'tcp';

$cfg['Servers'][$i]['extension'] = 'mysqli';

$cfg['Servers'][$i]['auth_type'] = 'config';

$cfg['Servers'][$i]['user'] = '**your-root-username**';

$cfg['Servers'][$i]['password'] = '**root-password**';

$cfg['Servers'][$i]['AllowNoPassword'] = true;
Surjith S M
  • 6,444
  • 2
  • 25
  • 46
Vikas Ck
  • 389
  • 3
  • 7
6

Try to restart your browser after changing the config file.

MrYoshiji
  • 51,182
  • 12
  • 115
  • 106
Prem
  • 61
  • 1
  • 2
  • 1
    +1. If that doesn't do the trick, clear your cookies as well. This problem drove me freaking nuts, and this was the simple fix. – Madbreaks Mar 29 '13 at 15:57
5
$cfg['Servers'][$i]['AllowNoPassword'] = TRUE;

was missing from configuration.

BenMorel
  • 30,280
  • 40
  • 163
  • 285
shri
  • 51
  • 1
  • 2
5

Go to this directory "xampp/phpmyadmin" and open config.inc.php file. On a Mac, go to /Applications/XAMPP/xamppfiles/phpmyadmin. Then change and configure the below code with your desired requirements. It worked with me. I installed both MySQL and XAMPP and worked successfully.

$cfg['Servers'][$i]['controluser']  = 'Your Username';   
$cfg['Servers'][$i]['controlpass']  = 'Your passwaord';
$cfg['Servers'][$i]['auth_type']    = 'config';
$cfg['Servers'][$i]['user']         = 'Your Username';
$cfg['Servers'][$i]['password']     = 'Your password';
mondieki
  • 1,392
  • 3
  • 14
  • 21
Muhammad Ashikuzzaman
  • 2,827
  • 5
  • 26
  • 46
5

Check following lines in config.inc.php in phpmyadmin directory

$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'yourpassword';
$cfg['Servers'][$i]['AllowNoPassword'] = false;

if your root account dont use any password set 'AllowNoPassword' to 'TRUE'

Uday Sawant
  • 5,371
  • 3
  • 30
  • 42
4

I faced similar problem and found an easy way out. After changing the password in config.inc.php, phpmyadmin did not start and message was access denied for user xyz@localhost

Step by step solution:

  1. imp: do not change password directly from config.inc.
  2. in the config.inc.php keep the password blank

    $cfg['Servers'][$i]['password'] = '';

    this will allow phpmyadmin to open without password.

  3. Under tab USERS click editpriviliges for root->followed by change password.
  4. Now if you again try and open localhost/phpmyadmin, it shows error access denied
  5. Now open config.inc.php and set the same password for user that you set in phpmyadmin example:

    $cfg['Servers'][$i]['password'] = 'xyz@abc';

  6. Now open phpmyadmin and it works!!

Piotr Kruczek
  • 2,314
  • 8
  • 18
2

I had same problem after i changed password in phpmyadmin. Iam usind xampp and windows. After i changed password in my phpmyadmin showed "access denied" and then after changes descripted below phpmyadmin showed blank page. I tried all advices and combinations given here, but problem still remained. I solved it through "config.inc.php", where i changed these lines

$cfg['Servers'][$i]['password'] = 'new_changed_password';
$cfg['Servers'][$i]['AllowNoPassword'] = false;

and then and final key - clear cache in your browser! good luck.

Olda Stiller
  • 77
  • 1
  • 9
1

This problem made me crazy.After a full day of wasting time I fixed it. I'm using WAMP.

  • Password was removed using console.
  • WAMP was uninstalled.
  • Computer was restarted.
  • WAMP was re installed.(Now i was able to open PhpMyadmin correctly)
  • Then the Password was set using PhpMyadmin privileges.
  • " $cfg['Servers'][$i]['password'] = ''; " in " C:\wamp\apps\phpmyadmin3.4.5\config.inc.php " was edited like this " $cfg['Servers'][$i]['password'] = 'Password given in PhpMyadmin privileges '; "
  • Now there was not any problem to open PhpMyadmin even with root password.
  • This video may helpfull. >> http://www.youtube.com/watch?v=lBvfa1wmlbI
PrazSam
  • 1,116
  • 1
  • 12
  • 20
1

I had this issues. I have fixed by changing phpmyadmin ini files configuration. As per xampp folder structure I found phpmyadmin configuration file in this location: C:\xampp\phpMyAdmin\config.inc.php

Just changing these line my problem solved.

$cfg['Servers'][$i]['password'] = '';

to

$cfg['Servers'][$i]['password'] = 'password';

Thank You !

Robin Hossain
  • 510
  • 5
  • 10
1

Check following lines in config.inc.php in phpmyadmin directory $cfg['Servers'][$i]['user'] = 'root'; $cfg['Servers'][$i]['password'] = 'yourpassword'; $cfg['Servers'][$i]['AllowNoPassword'] = false;

The above worked for me.After editing the above file,i restarted the wamp and it was all fine

0

rails-mysql-lost-password

If you are rails developer and you have lost password for mysql :

This answer is in connection with Ruby on Rails framework where this behavior occurred

  1. have mysql with user root and password
  2. bootstrap new rails project using with mysql "rails new projectname
    -d mysql"
  3. do not modify config/database.yml - defaults credentials for server are name: root, password is blank
  4. rake db:create prompt show up - asking for root password and then when you provide root password

the answer is in GRANT command on line 68 in here

basically it executed GRANT command with credentials matches your current database.yml

I have discussed this topic and behavior will improved and it is taken and reported as a bug.

Jakub Kuchar
  • 1,616
  • 2
  • 22
  • 38
0

You have a root account with no password. It would be best to have a look into the conf file located in your phpmyadmin directory and check with the password.

Shripad Krishna
  • 10,045
  • 4
  • 50
  • 63
0

I was looking for an answer but it's really easy to solve...

Open XAMPP App -> Go to General then open Terminal

execute the following command:

mysqladmin --user=root --password=[OLD_PASSWORD] password ""

But how to set a root password? without losing access to to phpmyadmin ?

Mohamed Horani
  • 534
  • 1
  • 8
  • 22
-2

In case you want to reset password to NULL do following:

  • Run MySQL Console
  • It will ask you the password you set. Enter password.
  • Run following command:

    mysql>UPDATE mysql.user ->SET Password=PASSWORD("") ->WHERE User="root"; mysql>FLUSH PRIVILEGES;

  • You may now access your phpMyAdmin again with PASSWORD not set for root.

Usman
  • 6,759
  • 12
  • 62
  • 101