0

When I try to connect on my DB using PHPMyAdmin, I now get this error:

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

Whereas it worked well for many months...
The fact is that there IS a password to connect, but PHPMyAdmin doesn't use it.
I tried to edit config.inc.php :

/* Servers configuration */
$i = 0;

/* Server: localhost [1] */
$i++;
$cfg['Servers'][$i]['verbose'] = 'localhost';
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['port'] = '';
$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'] = 'root';
$cfg['Servers'][$i]['password'] = 'xxxx';
$cfg['Servers'][$i]['AllowNoPassword'] = true;

/* End of servers configuration */

$cfg['DefaultLang'] = 'en-utf-8';
$cfg['ServerDefault'] = 1;
$cfg['UploadDir'] = '';
$cfg['SaveDir'] = '';


/* rajk - for blobstreaming */
$cfg['Servers'][$i]['bs_garbage_threshold'] = 50;
$cfg['Servers'][$i]['bs_repository_threshold'] = '32M';
$cfg['Servers'][$i]['bs_temp_blob_timeout'] = 600;
$cfg['Servers'][$i]['bs_temp_log_threshold'] = '32M';

my phpmyadmin.conf seems to be ok :

Alias /phpmyadmin "c:/wampserver2/apps/phpmyadmin3.5.1/" 

<Directory "c:/wampserver2/apps/phpmyadmin3.5.1/">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
        Order Deny,Allow
    Deny from all
    Allow from 127.0.0.1
</Directory>

I don't understand why always says using password: NO whereas there is one defined !
I tried to clear browser cache / cookies but still the same.
Also reloaded Wamp many times...

The DB password is not very important since it is only used on a local machine, but I also failed to remove the root password in mySql.
If I set password to '', there is a message saying that the quotes are not removed from password, so password is not blank, i have to connect with mysql -uroot -p'' (which is so stupid !!)

Thank you for any clue ! :)

Version: '5.5.24-log'  socket: ''  port: 3306  MySQL Community Server (GPL)
150423 15:48:27 [Note] wampmysqld: Normal shutdown

150423 15:48:27 [Note] Event Scheduler: Purging the queue. 0 events
150423 15:48:27  InnoDB: Starting shutdown...
150423 15:48:28  InnoDB: Shutdown completed; log sequence number 2080864866
150423 15:48:28 [Note] wampmysqld: Shutdown complete

150423 15:48:28 [Note] Plugin 'FEDERATED' is disabled.
150423 15:48:28 InnoDB: The InnoDB memory heap is disabled
150423 15:48:28 InnoDB: Mutexes and rw_locks use Windows interlocked functions
150423 15:48:28 InnoDB: Compressed tables use zlib 1.2.3
150423 15:48:28 InnoDB: Initializing buffer pool, size = 128.0M
150423 15:48:28 InnoDB: Completed initialization of buffer pool
150423 15:48:28 InnoDB: highest supported file format is Barracuda.
150423 15:48:29  InnoDB: Waiting for the background threads to start
150423 15:48:30 InnoDB: 1.1.8 started; log sequence number 2080864866
150423 15:48:30 [Note] Server hostname (bind-address): '(null)'; port: 3306
150423 15:48:30 [Note]   - '(null)' resolves to '::';
150423 15:48:30 [Note]   - '(null)' resolves to '0.0.0.0';
150423 15:48:30 [Note] Server socket created on IP: '0.0.0.0'.
150423 15:48:30 [Warning] Found invalid password for user: 'toto@toto'; Ignoring user
150423 15:48:30 [Note] Event Scheduler: Loaded 0 events
150423 15:48:30 [Note] wampmysqld: ready for connections.
Version: '5.5.24-log'  socket: ''  port: 3306  MySQL Community Server (GPL)

the toto@toto part looks awfull, but can't see where it comes from... ??

Random
  • 3,158
  • 1
  • 15
  • 25
  • Same issue: http://stackoverflow.com/questions/16845715/1045-access-denied-for-user-rootlocalhost-using-password-yes – Hardy Mathew Apr 23 '15 at 13:20

2 Answers2

1

Give like this

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

if password for user root is not set

To remove/change password

SET PASSWORD FOR 'root'@'localhost' = PASSWORD('MyNewPass');
Rex Rex
  • 1,030
  • 1
  • 8
  • 29
  • there is a password for root... i didn't manage to remove it. (I can only connect via command line) – Random Apr 23 '15 at 13:09
  • When I do `SET PASSWORD FOR 'root'@'localhost' = PASSWORD('');` i get the utput `Query OK, 0 rows affected (0.00ssec)`... and I still have to use my password to connect.... – Random Apr 23 '15 at 13:19
  • Update with new password and try in your code with new password – Rex Rex Apr 23 '15 at 13:20
  • Update the code with $cfg['Servers'][$i]['AllowNoPassword'] = false; – Rex Rex Apr 23 '15 at 13:33
1
**1 :** go to your WAMP icon on your PC desktop screen and LEFT CLICK to open the menu, you will see MYSQL folder, CLICK to see MYSQL CONSOLE, open it.

**2:** now you have DOS screen ( a black screen ) :


      --- if you already set a password, type it
      --- if you did not do this step yet, write the following red text
      --- use mysql; and click ENTER on your keyboard

**3:** now write the following red text and click ENTER :

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

do not worry about this sign ( -> ) , because for example when you write ( UPDATE mysql.user ) and you click ENTER on your keyboard, a new line appear with this sign ( -> ), your command will execute when you write this sign ( ; ) at the end of your text and click ENTER.

NOTE: replace the password ******* by your password.

**4:** now write the following red text and click ENTER :

FLUSH PRIVILEGES;

**5:** and to exit the black DOS screen now, write exit and click enter.

------------------------- we are finished from MySQL now --------------

**6:** go to WAMP folder ( open your My Computer, click on C driver, and you will see WAMP folder ), click on APPS folder, and than click on your PHPMYADMIN folder ( e.g my folder called phpmyadmin2.11.6 ) and find the config.inc.php

**7:** open config.inc.php and find the following orange text:

$cfg['Servers'][$i]['password'] = ''; // MySQL password (only needed

and add your password now that you used in step number 3 like that :

$cfg['Servers'][$i]['password'] = 'yourpasswordhere'; // MySQL password (only needed

**8:** now save this modification, and close config.inc.php

**9:** go to your web browser and type the following link :

http://localhost/phpmyadmin/107

and enjoy!!!
Hardy Mathew
  • 684
  • 1
  • 6
  • 22
  • have you restart the services and all?? please make sure your mysql password is same as you supplied in config file. – Hardy Mathew Apr 23 '15 at 13:34
  • Yeah, i restarted all services(via Wamp)... but the page still says `using password: NO`... It doesn't says wrong password ! It says that it doesn't even use a password... ! Can't understand this... – Random Apr 23 '15 at 13:38
  • Update **phpmyadmin.conf** ` Options Indexes FollowSymLinks MultiViews AllowOverride all Require local Order Deny,Allow Deny from all Allow from localhost ::1 127.0.0.1 php_admin_value upload_max_filesize 128M php_admin_value post_max_size 128M php_admin_value max_execution_time 360 php_admin_value max_input_time 360 ` – Hardy Mathew Apr 23 '15 at 13:42
  • and check with **config.inc.php** `/* Authentication type */ $cfg['Servers'][$i]['verbose'] = 'mysql wampserver'; //$cfg['Servers'][$i]['auth_type'] = 'cookie'; $cfg['Servers'][$i]['auth_type'] = 'config'; $cfg['Servers'][$i]['user'] = 'root'; $cfg['Servers'][$i]['password'] = ''; /* Server parameters */ $cfg['Servers'][$i]['host'] = '127.0.0.1'; $cfg['Servers'][$i]['connect_type'] = 'tcp'; $cfg['Servers'][$i]['compress'] = false; /* Select mysql if your server does not have mysqli */ $cfg['Servers'][$i]['extension'] = 'mysqli'; $cfg['Servers'][$i]['AllowNoPassword'] = true;` – Hardy Mathew Apr 23 '15 at 13:44
  • with phpmyadmin.conf, it doesn't work (i just changed the version to fit mine)... trying the config.inc.php – Random Apr 23 '15 at 13:46
  • Let's Open Mysql through the command prompt and check if it's working or not with given username and password , this issue clearly shows that issue with the username and password of mysql that not match with your config file. – Hardy Mathew Apr 23 '15 at 13:52
  • using command-line, I'm able to connect to mysql using root/xxxx that are defined in the config file... The commands asked in the answer worked well, the password is ok... only PHPMyAdmin is KO and doesn't want to use any password – Random Apr 23 '15 at 13:54
  • update the value `$cfg['Servers'][$i]['auth_type'] = 'http';` and check – Hardy Mathew Apr 23 '15 at 13:58
  • do one thing..!!! just take your backup of wamp server and install fresh copy and tried it , now it's seems only this will help you quickly. Hope it would work if not let me know i am here for you...!!! I am sure it will work!! – Hardy Mathew Apr 23 '15 at 14:03
  • With fresh installation of Wamp, PHPMyAdmin works... but when i add my mysql version, wamp won't start... I think I'll have to import a dump of my DB and reconfigure logins / passwords... thanks for your help – Random Apr 23 '15 at 15:11