An error occurred while installing the database:
│
│ ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using
│ password: NO) .
Why on earth is it not prompting me for the root password during the setup of phpmyadmin? This is just baffling to me. It doesn't ask for the password, tries to log in without a password and of course gets denied. It only prompts me for a new password for the phpmyadmin user.
How can I solve this? I'm at a loss. This is a pretty fresh install of Ubuntu 16.04. I've had MySQL setup and working for a while now with no issues. I can log in via mysql -u root -p
with no issues at all.
Coming back to this question as I believe I have found the answer. I use mariadb, and from what I gather you can only log in as -u root, even with password, when you run mysql with superuser permissions. This makes sense, as system services like mariadb are run as root. Therefore trying to access mariadb's root user from a standard user account won't work.
This has tripped me up multiple times, as mysql acts differently than mariadb in this case, and I had gotten used to the way mysql does it. If you run
mysql -u root -p
and enter the correct password (using mysql, not mariadb) it will work. It seems mariadb added another layer of security, needing you to not only know the mysql root user's password, but also have superuser permissions. Therefore, you must dosudo mysql -u root -p
anytime you need to access the database as the root user. I haven't tested to see if this only applies to command-line access, or if programs running at user level would also be denied with proper credentials -- I suspect they would. This encourages the much more secure practice of creating users with limited permission scope, who can access only the databases they need access to.So to the original point: this may have been a bug in phpmyadmin, as installing it via apt implies superuser permissions during install. Not sure what the specific issue with phpmyadmin is, but I do know why this bug happens.
I got around this by temporarily changing the root password to blank.
How to change my MySQL root password back to empty?
After running this, preferably in a separate tab of the terminal, rememeber to run the opposite to change it back:
Open a new tab of terminal, login to server, then run:
*Replace oldpassword with current root password
Then go back to tab with phpmyadmin installer. Click retry and go through the process. It will now work.
Then, go back to other tab after that finishes and run:
When it asks for password hit enter.
*Replace oldpassword with intended root password again.
Congratulations, phpmyadmin is now installed and root is secured again.