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.
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.
The problem is not with the phpmyadmin package, which uses dbconfig-common to make the configuration. The Debian OS now has a new passwordless default for MariaDB (MySQL) to make it more secure: https://github.com/ottok/mariadb-10.3/blob/master/debian/mariadb-server-10.3.README.Debian
So the problem occurs from dbconfig-common not knowing that we set a password for root. As seen in the README, we shouldn't set one anyway, but add privileges to another user. The dbconfig-common package obviously uses the now obsolete file /etc/mysql/debian.cnf, which, as stated, by default lists the root user, but no password. If you add the password to the file, the installation of any package with dbconfig-common will work. It will also work without a root password.
If you didn't provide password when installing phpmyadmin, you can find it in here
sudo -H gedit /etc/dbconfig-common/phpmyadmin.conf
Username: phpmyadmin
Password: password
Note: These are default values provided by the configuration script.
Ensure MySQL is installed and properly configured. Verify that the username and password specified in the configuration match MySQL credentials.
When you access phpMyAdmin, it acts as a client to the MySQL server. Therefore, the username and password you use to log in to phpMyAdmin are used by phpMyAdmin to authenticate with the MySQL server and perform database operations.
If you've set up MySQL with specific user name and password, you should use those same credentials when logging in to phpMyAdmin. This ensures that phpMyAdmin can connect to MySQL and perform operations on your databases using the correct permissions.
please uninstall any other MySQL servers like mysql workbench and mysql server because the port are taken by that and change the port of mysql its default
© 2022 - 2025 — McMap. All rights reserved.