Can't access PHPMyAdmin - php

I have MAMP server installed on my Macbook and everything worked fine, until I tried to add a password to the 'root' user of localhost. I selected a password and now whenever I go to localhost:8888/phpmyadmin, the page gives me an error saying:
1045 - Access denied for user 'root'#'localhost' (using password: YES)
It also says that the system tried connecting to MySQL, but MySQL rejected the connection and I have to check my username and password settings.
Why is it acting so weird and how can I get my PHPMyAdmin back to work?
It says I need to check the config.inc.php file, but I can't find that file in the MAMP folder.

the config file should be under:
/Applications/MAMP/bin/phpMyAdmin-X.X.X/config.inc.php
Edit it and verify the username//password used
You can always reset the root password using :
http://www.tech-otaku.com/local-server/resetting-mamp-mysql-root-user-password/

Related

PhpMyAdmin still presents login page even when 'AllowNoPassword' is set to true

I installed xammp, apache loads fine, but I ran into an issue where I was getting access denied when trying to open phpmyadmin database, so after a little search, google suggested going to phpmyadmin setting and locate my config.inc file in where the file config has a line that sets $cfg['Servers'][$i]['auth_type'] was set to config like this $cfg['Servers'][$i]['auth_type'] = 'config' on phpmyadmin settings, now after some research I found that people who had the same similar issue changed theirs to cookie like this $cfg['Servers'][$i]['auth_type'] = 'cookie', which I did, now I got the next issue which is a login page, when trying to login I get four errors.
ERROR - 1 Can not log in to the MySQL server
ERROR 2 - mysqli_real_connect(): (HY000/1045): Access denied for user 'pma'#'localhost' (using password: NO)
ERROR 3 - Connection for controluser as defined in your configuration failed.
ERROR 4 - mysqli_real_connect(): (HY000/1045): Access denied for user 'root'#'localhost' (using password: NO)
I then did a little google search and people said to remove the password, set
$cfg['Servers'][$i]['AllowNoPassword'] to true some thing like this $cfg['Servers'][$i]['AllowNoPassword'] = 'true',
have done that but nothing happened, the login page still appears, is there a way to eliminate this, its driving me nuts over here.
THANKS IN ADVANCE...
You're getting two different errors here; phpMyAdmin can be configured to use an optional user (called the 'controluser', 'pma' in your case) for enhanced features. If you haven't created the user, you'll see an error message, but you can edit your config.inc.php to remove or comment out the lines referencing 'controluser', 'controlpass', and 'pmadb' to disable these advanced features. However, that doesn't seem to be your problem here.
The second error message, about the root user not being able to connect, indicates that there's a problem communicating with or authenticating to the MySQL server. You should try connecting from the command line client to see if you're able to connect as the root#localhost user (which is MySQL shorthand for using the socket connection type rather than TCP/IP networking). You can probably test this with mysql -u root -h localhost.
If the AllowNoPassword variable were causing the problem, you should instead see the error message
Login without a password is forbidden by configuration (see AllowNoPassword)

MAMP and PHPMyAdmin: #1045 - Access denied for user 'root'#'localhost' (using password: YES) [duplicate]

This question already has answers here:
MySQL ERROR 1045 (28000): Access denied for user 'bill'#'localhost' (using password: YES)
(43 answers)
Closed 4 years ago.
I have MAMP installed and I've never had a problem with it. Today I tried logging in to PHPMyAdmin and I got the following error message:
1045 - Access denied for user 'root'#'localhost' (using password: YES)
In my config.inc.php file, the following options are set:
$cfg['Servers'][$i]['auth_type'] = 'config'; // Authentication method (config, http or cookie based)?
$cfg['Servers'][$i]['user'] = 'root'; // MySQL user
$cfg['Servers'][$i]['password'] = 'root';
I've never changed my password. This is a local install, so I've always used 'root' for username and password.
I've tried accessing MySQL through the terminal:
/Applications/MAMP/Library/bin/mysql
But I get this:
ERROR 1045 (28000): Access denied for user 'boneill'#'localhost' (using password: NO)
Not sure what could have happened. I haven't changed passwords or anything like that. It just stopped working all of a sudden. Any ideas?
Start MAMP
The MySQL server must be running to change the password, open and start MAMP now. keep it running until the end of this.
Mac Terminal
With the MySQL server running, open the terminal (located in '/Applications/Utilities') enter or copy/paste the following:
/Applications/MAMP/Library/bin/mysqladmin -u root -p password
You'll be prompted for a password. Enter the current password for the root user. If you changed it in phpMyAdmin, use that password.
Mosty password is blank so just press Enter and Enter Your New Password.
$ /Applications/MAMP/Library/bin/mysqladmin -u root -p password
Enter password:
$ /Applications/MAMP/Library/bin/mysqladmin -u root -p password
Enter password:
New password:
Confirm new password:
Now You Have to make changes in some file:
You need to replace all occurrences of the old root password with the new one you just created. To keep it easy here is a list of the files, you can open them in your favorite text editor and search for 'root', changing
'-proot' to '-p NewPassword', replacing 'NewPassword' with your own.
/Applications/MAMP/bin/phpMyAdmin/config.inc.php
/Applications/MAMP/bin/checkMysql.sh
/Applications/MAMP/bin/quickCheckMysqlUpgrade.sh
/Applications/MAMP/bin/repairMysql.sh
/Applications/MAMP/bin/stopMysql.sh
/Applications/MAMP/bin/upgradeMysql.sh
Stop and restart MAMP
I hope that works/make sense because this works for me.
If I were you, I would just take your htdocs folder and just reinstall mamp. I've had this issue occur installing wordpress locally, setting the config file with a db user without a password, and then changing the password after the config was created in the installation process. I don't know why I did this but this installed wordpress with a user without a password, when the database required a password, so it then was giving me an authentication error.
Taking into consideration that you seem to have trouble debugging the issue, I think the most easiest way to rule out some of the probabilities is to install:
MySQL Workbench
It's free and you can use it as a GUI to try logging in to "localhost" or better "127.0.0.1" port 3306, user "root", password as you've chosen.
If you still notice an error connecting to the database, go to control panel -> services and check the status of the MySQL database. It might have crashed. Try to restart the service. If it shuts down again immediately, check your disk space. If you are running low on disk space, tables might have got corrupted. Also, check your firewall rules. If you are working in a corporate environment, somebody may have deployed new security polices - this might lead to port blocking, application networking issues etc. pp. -- even on your local host. Automatic windows updates might cause those changes too.
If it works using MySQL workbench, you can rule out any issue on database side. You can focus on PHP / MAMP then. Check the version and if any update has been installed (probably automatically). Is php mysql module installed and configured (php.ini, ensure php mysql dll is loaded).
Go to MAMP dashboard and Click on MySQL tab.
There button called "Change password for user "root":
Click on the button and change it.
Thats it.

wamp server - access denied when navigating localhost/phpmyadmin

When trying to reach localhost/phpmyadmin in WAMP, I get the following error:
Error: #1045 - Access denied for user 'root'#'localhost'
Please tell me if I need to reset my password, or how to get it?
The MySQL manual explains how to reset permissions, but the MySQL defaults are username root with a blank password. I don't know if WAMP might have set an alternative default password instead.

WAMP phpmyadmin error

I just installed WAMP server and for creating a new local database, when I clicked phpMyAdmin, i am getting this error,
Error
MySQL said: Documentation
1045 - Access denied for user 'root'#'localhost' (using password: YES)
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.
Can some one please help me??
you are connecting to your local machine. If i am correct wamp does not set any credentials. So you should be fine to login with root and no password.
It's been a while since I have used WAMP (I only use Linux and OSX these days) I seem to remember the following...
In a command prompt enter in the mysql directory :
mysqladmin -u root password NEWPASSWORD
By default a mysql root password is not set yet the phpmyadmin pages are set to to connect with a password.
Dave
If you user has not password connect so. Try do it:
mysql_connect('server','user');
without thrid parameter. If all is right, you are connect to server.
else, if your user has password, you need provide the password correct
mysql_connect('server','user','password_correct');

phpmyadmin username and password

I'm using phpmyadmin 5.1.36 through wampserver in my windows system. when i give http://localhost/phpmyadmin it directly gone into, showing databases what i did is i changed the password for the username root and phpmyadmin showed a message password successfully changed when i refresh the page it showed error
1045 - Access denied for user 'root'#'localhost' (using password: NO)
What i expect is the page which is asking for username and password. What should be done to get this.
Try checking your config file; there should be a line that says $cfg['Servers'][$i]['auth_type']. This should be set to either cookie or http if you want the username and password to be entered via login form.
You'll have to change phpmyadmin's configuration to use your new root account password. Since you change the mysql root user password, phpmyadmin can no longer log into the database, and is now essentially dead until you update its configuration file with the new password.
You need to set this behavior in the PMA's config.inc.php. You will need to set the auth_type to HTTP.

Categories