[Solve] VestaCP (HY000/1045): Access denied for user ‘PHPMyAdmin Ubuntu 18.04 20.04

After the successful installation of VestaCP on a ubuntu 18.04 LTS virtual private server, there is a login problem for PHPMyAdmin. When we try to login to PHPMyAdmin using the correct password, a problem with code “(HY000/1045): Access denied ” occurred.

If you have any doubts regarding your VestaCP installation, I would suggest you look out this tutorial.

What is the problem?

(HY000/1045): Access denied for user 'PHPMyAdmin'@'localhost' (using password: YES).

Vestacp access denied for user ‘root’@’localhost’

VestaCP PHPMyAdmin login problem

Now the question is, how to solve this vital problem? There are a number of solutions regarding this problem. In this post, I am sharing a solution to that particular problem.

Solutions 1:

Solution: Connect your server using PuTTy SSH or other whatever you want. Make sure you have administrative or root privilege. If not then use the following command followed by your password.

sudo su

First, make sure that you have changed the default vesta password in my.cnf and mysql.conf file. If not, then change it using the commands given below.

nano /root/.my.cnf
nano /usr/local/vesta/conf/mysql.conf

Then use the following command-

mysql -u root -p

Now enter your password and hit enter. Using this command now you have entered into MySQL command-line interface (CLI) service. Now type –

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'xxxxxxxx';

Where “xxxxxxx” is to be replaced. Hit enter key. Now you can log in to your PHPMyAdmin.

If the above solution does not world you may try the second solution.

Solution 2: Changing the MySQL root password

If solution 1 does not work, then try this.

Stop MySQL service

sudo service mysql stop

Then try the following commands-

sudo mkdir -p /var/run/mysqld
 sudo chown mysql /var/run/mysqld

Now stop MySQL service using the following command-

 sudo service mysql stop

Then use these commands-

 sudo mysqld_safe --skip-grant-tables --skip-networking &
 FLUSH PRIVILEGES;
 mysql -u root
 use mysql;

Now update user password using command-

 update user set password=PASSWORD("xxxxxxxx") where User='root';

Where “xxxxxxxx” is to be replaced by your own password. Then use the last command.

 flush privileges;
quit

Solution 3: UPDATE user SET

In general, this solution works on ubuntu 14.04 to 16.04. This is pretty much similar to solution 2. This may work on CentOS. Use the commands given below.

sudo mysql -u root 

Provide your root password and hit the enter key.

USE mysql;
UPDATE user SET plugin='mysql_native_password' WHERE User='root';
FLUSH PRIVILEGES;
service mysql restart

You are done. Now you can log in to your PHPMyAdmin page using your password.

Conclusion

This is a common problem with vestaCP. Whenever I install VestaCP on ubuntu, I face this problem each time. In my case, I am using Ubuntu 18.04 and solution 1 work for me. I hope one of these solutions will also work for you. If not, please leave a reply.

You May Also Like
[How To] Change Default Admin Login Port(8083) of VestaCP?

Leave a Comment