I tried to install phpMyAdmin on Ubuntu 16.04LTS, for MariaDB and Apache. The problem is that during the setup process, it asks me about 'root' name, but not for root's password, and I end up with common ERROR 1045 (28000): Acces denied for user 'root'@'localhost' (using password: NO)
Lately I've reinstalled Apache and MariaDB, but I don't know how to deal with this problem. I've already tried dpkg-reconfure dbconfig-common
, and dpkg-reconfigure phpmyadmin
, but every time this ERROR showed up.
Also, I know the root password, and I can normally log in with mysql -u root -p
, so the only question is how to give it to the phpmyadmin.
I checked my config.inc.php, but I can't see any place to put either administrative user's name or passowrd.
How to fix “Error 1045 (28000) access denied for user 'root'@'localhost' (using password: yes)”? It arises when you perform a fresh installation of MySQL and try to login with a password. The default password of MySQL is blank () (i.e. empty string). So, you can login to the MySQL server using the same password.
I fixed this issue by temporarily removing the root password.
Log into mysql using mysql -uroot -p
.
Execute SET PASSWORD FOR root@localhost=PASSWORD('');
to remove the root password.
After that, execute dpkg-reconfigure phpmyadmin
or re-install phpmyadmin
, follow the installation as you normally would. Once that is done, run mysql_secure_installation
again to set a root password again.
You can now log in with that password as root
using phpmyadmin as normal.
I had the same problem in Ubuntu 20.04. However setting root password to empty with
ALTER USER 'root'@'localhost' IDENTIFIED BY '';
as suggested in other answer did not help. I was still getting the same error from the phpmyadmin setup. I chose the "ignore" option in that phpmyadmin setup dialog, and then manually created phpmyadmin database and user, and manually created tables as follows:
mysql> create database phpmyadmin;
mysql> create user 'phpmyadmin'@'localhost' identified by 'some_passwd';
mysql> grant all privileges on phpmyadmin.* to 'phpmyadmin'@'localhost';
Where 'some_password' was the same as I specified in the setup dialog and which in consequence was saved in /etc/phpmyadmin/config-db.php
Then I went to /usr/share/phpmyadmin/sql
and ran
$ mysql -u phpmyadmin -p phpmyadmin < create_tables.sql
and specified that 'some_password'. This made phpmyadmin happy and it started to work as expected.
I also needed to allow the webserver access to /usr/share/phpmyadmin
in apache2 config, because the phpmyadmin setup failed to do that properly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With