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.
Related
I have a straight forward script that is trying to connect to a MySQL database.
When I run the script, I get the error:
Warning: mysqli_connect(): (HY000/1045): Access denied for user 'root'#'localhost' (using password: YES) in C:\xampp\htdocs\ShopSite\submitReg.php on line 16
Failed to connect.
The connection code is:
$server="127.0.0.1";
$db="shop";
$user="root";
$password="";
$conn=mysqli_connect($server,$user,$password,$db) or die("Failed to connect");
I can connect to phpMyAdmin and edit the database on there just fine. I am using XAMPP and running it locally.
When I go to user accounts, it says there is no password for root. I looked in the config file and there are no passwords set. I haven't set a password for anything.
I haven't went in and fiddled with settings, or created any new accounts. It was working fine (never used to get this problem), then it just started with this. I reinstalled XAMPP, still giving me this issue.
I don't get why it says using password "YES".
I've been at this for hours trying to fix it. I've looked through lots of threads. Not all necessarily apply to me, as I am running it locally, and haven't been going in and making new user accounts. Everything is default.
Before I reinstalled, I tried creating a new user account and giving it the necessary privileges. I gave it a password too. Didn't work.
I don't get why it is doing this, and am not knowledgeable enough to fix it myself. Any help is much appreciated, so that it can go back to connecting.
change
$server="127.0.0.1";
by
$server="localhost";
I used XAMPP for a while and it worked quite good for me,
i think the default password for your mysql server is not set to '', so i guess
if you change the root password and try accessing your database using the new password, it should work.
Updating the root password
To update the root use password, you have to go by these steps:
Open the XAMPP Control Panel
Click on the MySQL button
After the MySQL console has loaded, execute this query:
SET PASSWORD FOR 'root'#'localhost' = PASSWORD('pass');`
After that, change the $password variable to the new password which
is in this case pass
Adding a new user
You could also add a new user by executing this query:
GRANT ALL PRIVILEGES ON *.* TO 'new-user'#'localhost' IDENTIFIED BY 'password';
While the username is new-user and the password is password.
I hope this helps.
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.
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/
I have a website that connects to a database and retrieves page content and all works fine. However, I then use the same database connection to connect to and retrieve user details for logging in to my site (2 tables but both in same database). However, I get the following error message when doing this.
Warning: mysql_query() [function.mysql-query]: Access denied for user 'username'#'localhost' (using password: NO)
The hint is in "using password NO" There is no password being sent - in fact it is only using username#localhost as the username so it looks like you don't have your credentials configured properly.
Check config.inc.php - http://wiki.phpmyadmin.net/pma/Configuration_storage
Well it's says that your password is not correct and that you haven't gained access. Can you please upload a code here ? if you're using localhost, then the username should be root .. try to change it and leave the password field empty for now.
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');