10

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.

1
  • 2
    Did you fix this issue? I'm having the same problem at the moment and can't seen to find a solution.
    – confetti
    Dec 31, 2017 at 9:08

2 Answers 2

17

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.

1
  • that's ridiculous!
    – Palo
    Nov 13, 2021 at 13:32
1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.