Word – #1045 – Access denied for user ‘root’@’localhost’ (using password: NO)

MySQLpasswords

I've installed xampp on my MAC computer in my table I saw a word named user I clicked it and I saw that I was able to change from not having a password by default to using a password. I clicked it and filled in a password. Afterwards I was banned from mu phpadmin and my table. When I try getting through phpMyAdmin through the WAMPSERVER icon, a page pops up stating:

Error MySQL said:

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

I looked on this site and tried the following with no luck.

phpMyAdmin tried to connect to the MySQL server, and the server rejected
the connection. You should check the host, username and password in your
configuration and make sure that they correspond to the information given
by the administrator of the MySQL server.

I am not allowed to make changes in config.inc.php file, it does not save the changes.

I tried mysqladmin, no luck
and in terminal – bash some commands, no luck.

Could you help me please to log in or reset?

Best Answer

You will probably need to edit config.inc.php as superuser and not as your regular user account. You can accomplish this with

sudo nano /path/to/config.inc.php

(sudo causes the command that follows it to run as an administrator, essentially; nano is a command-line text editor)

It will prompt you for your mac user's password, and then launch the editor with administrative privileges (which can edit the file). Make your changes to it, and then press Ctrl+O to save the changes, and then press Ctrl+X to exit and return to the command prompt. You should then be able to log in to phpmyadmin.

The changes you'll probably need to make are:

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


If you would like to revert the changes you made (go back to not using a password), you may try the following from the command line:

mysqladmin -u root -p password ''

It will prompt you for the password you set on root, enter it, and then it should go back to root not having a password.

Related Question