-6

This is the error I am getting when I run my php file. I have searched over the network and found some tricks to solve the error but all in vain. some of them suggested to change the username and password for the localhost server and some advised to change only the password.

I tried both and ended up crashing phpmyadmin panel. The other user suggested to change the ports of the running servers. I specifically use mamp as I am using mac os.

I tried to change the ports but nothing worked. Afterwards I looked upon many blogs and web-articles but they also proved to be the same. One site advised to change the mamp config by using the terminal application.

When I tried to change the mysql password nothing appeared on the screen and when I approached for changing the phpmyadmin password it reflected error which said that no such directory is found.

I reinstalled mamp several times but no effect.

Please answer as soon as possible because I am stuck here and no one seems to act as a savior for me.

Parth Pandya
  • 1,050
  • 7
  • 15
  • 22
  • Could do share your php file ? – kenfire Aug 31 '17 at 09:31
  • 2
    Possible duplicate https://stackoverflow.com/questions/489119/mysql-error-1045-access-denied or https://stackoverflow.com/questions/19989418/error-1045-28000-access-denied-for-user-rootlocalhost-using-password-n – kenfire Aug 31 '17 at 09:32
  • 4
    Possible duplicate of [ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)](https://stackoverflow.com/questions/19989418/error-1045-28000-access-denied-for-user-rootlocalhost-using-password-n) – kenfire Aug 31 '17 at 09:33
  • Where is the code? – Lamar Aug 31 '17 at 09:38
  • how to view the current password??. I cant find it because I didnt set it while installation. I am using the by default root user. – Parth Pandya Aug 31 '17 at 09:40
  • You can't view the password. You can reset it https://dev.mysql.com/doc/refman/5.7/en/resetting-permissions.html btw, i hope you don't plan to use the root login for your web app. Any mess ups in your sql code can lead to an attacker to enter db's you do not want them in! – IsThisJavascript Aug 31 '17 at 09:42
  • can anybody tell me how to upload my code that is .php file???? – Parth Pandya Aug 31 '17 at 09:56

1 Answers1

1

Go to the config.inc.php file

In the file, search for the line

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

and change it to

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

Hope it helps

Lizesh Shakya
  • 2,482
  • 2
  • 18
  • 42
  • I looked into the config.inc.php file and searched for the above listed line and found that the password is already set to 'root.' – Parth Pandya Aug 31 '17 at 09:46