I installed phpmyadmin on my ubuntu server following these steps here:
https://www.rosehosting.com/blog/install-phpmyadmin-on-ubuntu-16-04/
I installed apache, php, mysql following these steps:
https://vijayasankarn.wordpress.com/2017/01/17/setting-lamp-stack-in-ubuntu-16-04-using-aws-ec2/
and when I goto login to http://myserver.com/phpmyadmin I get this error:
mysqli_real_connect(): (HY000/1045): Access denied for user
‘root’@’localhost’ (using password: YES)
What am I doing wrong? Am I missing a step that is not in the links above?
I have tried this:
mysql> USE mysql;
mysql> UPDATE user SET plugin='mysql_native_password' WHERE User='root';
mysql> FLUSH PRIVILEGES;
mysql> exit;
$ service mysql restart
and this
mysql -u root -p
use mysql;
update user set plugin="" where user='root';
flush privilege;
3
Answers
This error can be fixed, the following command will reconfigure your phpMyAdmin credentials to gain access to the MYSQL DB:
/! This will provide few interactive menus that will allow you to reconfigure the phpMyAdmin package with NEW credentials /!
But you could also reconfigure it manually :
1 – Log into mysql as root
2 – Make sure ‘phpmyadmin’ user exists :
3 – Switch to the appropriate MYSQL DB :
4 – Set new password for the phpmyadmin user
sudo mysql -u root -p
USE mysql;
UPDATE user SET plugin=’mysql_native_password’ WHERE User =’root’;
FLUSH PRIVILEGES;
exit;
sudo systemctl restart mysql
Check to see that you have actually set the root password in MySQL. You might find that when logged in as the root Linux user you can run
mysql -u root -p
and get access to your database no matter which password you specify, because the password hasn’t actually been set. Use
ALTER USER 'root'@'localhost' IDENTIFIED BY 'PASSWORD'; FLUSH PRIVILEGES; EXIT;
to set your password, then try phpMyAdmin again.