When we installed and configured VestaCP with the Ubuntu 18.04 LTS server we got a serious error message with the MySQL 5.7 database server.
This error message was clearly seen after the initial installation process of VestaCP was completed, where we had a problem when configuring the database for the web.
This problem allows us to access phpMyAdmin with random passwords or even incorrect passwords.
Obviously this is a serious problem, which can ultimately make someone (hacker) easily get access to our database server and can damage our system.
What makes us even more confused is that the MySQL 5.7 root password access in the phpMyAdmin User Account is automatically set to “NO”, where it should be set to “YES”.
So that allows us to access phpMyAdmin with the proper root password, instead of random password.
In addition, if we don’t add the “skip-grant-tables” command in the my.cnf configuration, the MySQL 5.7 database server will not work properly.
Well, if you currently have the same problem and want to fix this error, you can follow the following tutorial.
1. Login to the SSH terminal with root privileges and run the following command
$ service mysql start
2. Backup the mysqld sock folder under the /var/run directory
Now, Go to sock folder:
$ cd /var/run
$ cp -rp ./mysqld ./mysqld.bak
3. Stop your MySQL 5.7 database server and restore the mysqld sock folder
$ service mysql stop
$ mv ./mysqld.bak ./mysqld
4. Now let’s start MySQL 5.7 in safe mode
$ mysqld_safe --skip-grant-tables --skip-networking &
Init mysql shell:
5. Then login to your MySQL 5.7 database server with this simple command
$ mysql -u root
6. Open the mysql database and update the correct root password for the authentication string.
$ mysql> use mysql;
$ mysql> update user set authentication_string=password('rootpassword') where user='root';
$ mysql> update user set plugin="mysql_native_password" where User='root';
OK… now you can run flush privileges and quit from MySQL server
$ mysql> flush privileges;
$ mysql> quit;
7. All DONE… now you can access phpMyAdmin with the correct MySQL root password. However, be sure to first check your MySQL 5.7 via SSH terminal
$ mysql -u root -p
We are a bunch of people who are still continue to learn Linux servers. Only high passion keeps pushing us to learn everything.