MAMP mysql issue - mysql

I am currently using MAMP and I've come across an issue when I try to access localhost:8888/MAMP/?language=English
I get Error: Could not connect to MySQL server!
All of my sites are accessible, just not the MAMP admin area.
I've read that I may need to change the password, but when I run
/Applications/MAMP/Library/bin/mysqladmin -u root -p password NEWPASSWORD
I get:
/Applications/MAMP/Library/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'#'localhost' (using password: YES)'
Why is any of this happening and how can I get it back to working order?

It looks like the root password is not what you expect it to be. No telling how that happened or if it's simple typos, but just in case it got changed out from under you, here is a handy little guide to resetting the root password, which will allow you to administer other users passwords, etc.
mysql.com reset root password on Unix

Be sure to also modify /Applications/MAMP/bin/mamp/index.php. The mysql root password is hard coded in there. You want to change this line:
$link = #mysql_connect(':/Applications/MAMP/tmp/mysql/mysql.sock', 'root', 'root');
so the second "root" is what you changed your mysql root user's password to be. Hopefully, when you launch index.php, you will no longer get that error.

Related

Unable to login to MySQL as root

I have completely locked myself out from MySQL.
The solutions I find out there suggests to run sudo mysql -u root which used to work but I can't even login that way.
Error: ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: NO)
I tried to reinstall MySQL but that didn't help either since I am still being prompted for a password, how is this even possible?
Anyone has experience with this?
Solution
When I uninstalled the software I didn't do all the necessary steps, I followed this guide in order to re-install it and I now have access again!
The syntax you are using assumes that there is no root password set. The error messages shows that there is a password set. Berto99's answer shows you how to get the system to prompt for a password. Note that this "root" account is not the same as a "root" account configured on your host - but may have been configured to use the same password.
If you don't know what that password is, you can force the system to change it by starting the mysql service with an init script which changes the password e.g.
ALTER USER 'root'#'localhost' IDENTIFIED BY 'NewPassword';

Change password in root and error in accessing localhost/phpmyadmin

I tried to change password in my database but after i changed it right away, I got an error saying
mysqli_real_connect(): (HY000/1045): Access denied for user
'root'#'localhost' (using password: NO)
and
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.
How to fix this? Do i need to configure something about the connection and where can I fix it?
Do you able to connect mysql in command line.
#mysql -u root -p
then provide the password to access mysql command line.
if Yes, then please make sure that you given the correct information while installing the phpmyadmin.

MySQL not working with Laravel

This may be a noob question.
But I have tried everything, purging and reinstalling trying to reconfigure and the works.
For some reason my root that was set without a password on localhost is denying me access
I have tried to reset the root password using the command line but to no avail.
Does anybody know how to get this error to be fixed?
ERROR 1045 (28000): Access denied for user 'devin'#'localhost' (using password: NO)
I am using linux and ubuntu
Even though you set your root user to login without a password, this does not mean that user devin has been configured to login without a password.
Edit your .my.cnf file:
vi ~/.my.cnf
In the file which you see, hard code the password for user devin, save the file, then exit.
[client]
user=devin
password=your_password_goes_here
Then restart MySQL and devin should be able to login without using a password.
The following command should work to connect you to a database called my_db:
mysql --user=devin my_db

Reset MySQL root password to "default" - MAMP

I changed my root level password on phpMyAdmin. I was unsure where to enter the password itself, as it did not give me the option (login form). I wondered if it was the php.ini file but users with read privileges could read it if I placed the password in there.
Now, the mysql doesn't run as I tried various online resources to fix the problem. If needs be I would delete mamp and re-install but I do not want to lose my database files. Ideally I would revert the password to default, which I believe was nothing, except now I cannot connect to phpmyadmin, or the mamp start page:
Error: Could not connect to MySQL server!
Any help would be great.
UPDATE -
Error message from mamp:
/Applications/MAMP/Library/bin/mysqlcheck: Got error: 1045: Access denied for user 'root'#'localhost' (using password: YES) when trying to connect
This seemed to have fixed it when using terminal to reset the password:
/Applications/MAMP/Library/bin/mysqladmin -u root -p password newpassword
Found on mamp faq.
Look in the files:
checkMysql.sh
quickCheckMysqlUpgrade.sh
repairMysql.sh
stopMysql.sh
The important one in this case is "quickCheckMysqlUpgrade.sh".
All the files are located in the /Applications/MAMP/bin/ directory.
In these files you'll find something like
# /bin/sh
/Applications/MAMP/Library/bin/mysqlcheck --quick --check-upgrade -u root -proot --socket=/Applications/MAMP/tmp/mysql/mysql.sock mysql
When you see -proot that is the password MAMP will try to use,
-p{password}.
-p means "password" and whatever comes after is the password.
So change "-proot" to eg. "-pmysecret" or whatever your password is.
I was being annoyed by the startup "access denied" error MAMP would show, even though I was able to access my site using phpMyAdmin or other SQL tools. I even found/updated the password in checkMysql.sh, repairMysql.sh, and upgradeMysql.sh. I did not notice the script called quickCheckMysqlUpgrade.sh and correcting the password in that fixed the startup error for me.
I just solved this issue on my MBP!
In MAMP Pro (v352), go to the MySQL tab and press "Change Password".

I can't create a new user in MySQL, and I can't access it

I have MAMP installed on my mac, and perhaps without realizing it, I must've changed something, because whenever I enter into the terminal:
/Applications/MAMP/Library/bin/mysql --host=localhost -uroot - proot
I get back:
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: YES)
I have read endless similar posts about people with the same problem, and they're told to create/edit a new user, but I can't do that if I can't get into MySQL using a user with privileges.
I never had any problems accessing MySQL with root with default passwords before today.
Well first off, I have to say, DON'T USE MAMPP. Go ahead and use XAMPP for mac, the problem with using MAMPP is it messes with ports and all that stuff. Also, unless other wise entered your login username should be 'root' and host as 'localhost', with no password.
My advice: look into getting XAMPP