phpMyAdmin can't connect to the MySQL server - mysql

I am using MAMP.
It seems that when I tried making some changes with the passwords, I messed it up and now I can't access anything on phpMyAdmin.
I've tried to reinstall MAMP, but all I get is still the same error.
Does anybody know how to fix this?
UPDATE: Even in terminal I get the same error
/Applications/MAMP/Library/bin/mysql --host=localhost -uroot -proot
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: YES)

check your configuration file in MAMP, the password isn't defined
The reinstallation doesnt rewrite conf files

Try resetting your root password via the console. Instructions can be found here.
The instructions cover Windows and *Nix.
The reason why when you re-installed MAMP/WAMP/LAMP/MySQL etc and it doesn't remove the password is because it saves the config files, and when you remove MySQL it doesn't delete the config files relating to the passwords.
I've had this issue on Windows and Linux - But I can see it affects Mac's too.
Edit: I am assuming you have console access, because you mention MAMP - If you don't, try your host' control panel, it will have an option for Mysql there.

Related

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

Access denied for user 'root'#'localhost' (using password: YES) EVEN when the Password works on PhpMyAdmin

I have an issue with accessing MySQL using root and password.
I am trying to connect the Server using PuTTY SSH using
> mysql u root -p
For an unknown reason I can NOT access the Database and I am getting rejected with the following ERROR:
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: YES)
The weird thing is that I am using the same password with PhpMyAdmin using Web and I can access everything. I need to run a script that will allow the SQL server
root#localhost user
run the query over the LAN and not the web.
Therefore I need the user to connect using command line SSH or something like that.
How can I fix that issue? the user rott and password WORKS just fine through PhpMyAdmin and not through SSH PuTTY, Why?
Is there something I need to do in order to fix this? I have been working with the Database for 2 years now using the web interface. Now I need to have it working using SSH (22).
Please assist.
thanks in advance.
Arye
It sounds like you need to update the your password for root on MySQL.
Check here: MySQL - ERROR 1045 - Access denied
Thank you all for your help. I have managed to overcome the issue: (see below)
That was FIXED Only when I changed from old password to new. in my.cnf file I have removed the flag for old_password=1 and Restart the service of MySQL.
Then I have created a NEW password (using the old one I had) and it was created with 41 (NEW) Hash length and not 16 (OLD)..
Then I did flush privileges as you recommended - and IT WORKS.
Thank You!
> mysql -h your_host_name -P your_port_number -u your_user_name -p
try with hostname option it should work!
Ubuntu 18.04 running MySQL 5.7.28 creates a file /etc/mysql/debian.cnf. It contains some credentials and other settings. So, this debian-sys-maint user is by default a root equivalent. It is used by certain maintenance scripts on Debian systems, and as a side-effect, allows users with root access on the box to view the plaintext password in /etc/mysql/debian.cnf. If your SSH using a client fails after a fresh install through root try using the credentials set in this file.

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".

Unable to update security settings. Access denied for user 'root'#'localhost' (using password: YES)

While running mysql-installer-community-5.6.10 during the Configuration step, I get the error:
Unable to update security settings. Access denied for user 'root'#'localhost' (using password: YES)
and the configuration fails.
... and the password is being set during the previous step of the configuration process, so I don't see how it possibly could be wrong...
I have tried turning off the Windows Firewall but it has not helped.
Could anybody help me out with this?
I just had this problem. The prior install screen had asked for the Current root password. But this was the first MySQL install on the machine.
Answer: when asked for the Current root password, leave that field blank. Then the server installed ok.
I had the same issue, and my first install of mysql ever. For me it was the fact that I did not run the .msi installation file as administrator. By launching through a command prompt that was run as admin the issue was resolved. This is on Windows 7.
Also, I uninstalled twice for this issue. Once I deleted the (nonexistent) serverdata. In that case, the reinstall did not ask for Current root password. When I did not delete serverdata, the Current root password was indeed asked at reinstall. So you can bypass Current root password I believe.
I just had the same issue. This helped me
C:\ProgramData\MySql\
Remove folder "MySQL Server" and all conf files.
The problem is that MySQL saves its configuration data in a different location and that includes your old root password. If you're going to re-install MySQL you have to first delete this old configuration data which can be found in:
C:\ProgramData\MySQL
You may have to tell windows to show hidden files and folders because this folder is hidden by default.

Can't log into or get Mysql cmd line

I have a VPS running CentOS and have apache, php, mysql all installed. I was following a tutorial for installation and apparently did something wrong when setting up mysql (I believe something with setting user and password). Now whenever I try to get to the MySQL command line interface I receive this error.
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: YES)
I looked this up and got a few suggestions to try to bypass so I can reset the passwords. I've tried:
/etc/init.d/mysqld --skip-grant-tables
Which came up with the same error. I tried reinstalling by first removing mysql and then installing it again. Same Error appears. What else can I do?
(if U don't have anything in DB, remove mysqlDB - not installation, but DB files in /var/lib/mysql/ - backup it first!)
start this: shell# mysql_secure_installation
it will ask U to:
Set a root password. If you already have it
you’ll need to enter it for the remaining steps.
Remove anonymous users
Disable non-local root access
Remove the test database and access rules related to it
Reload privilege tables so the above changes are in effect
BR