Setting up MySQL Server on Ubuntu Server
In the most recent versions of Ubuntu, after installing MySQL Server you cannot log in as the MySQL root user with a password unless you are the operating system’s root user.
To be able to log in as the MySQL root user from another Linux user, follow these steps on the command line:
mysql_secure_installationand follow the steps.
open MySQL
mysql -u rootChange the authentication plugin of the root@localhost user
mysql> update user set plugin="mysql_native_password" where host="localhost" and user="root";then we can change the root user’s password
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'desired_password';Now we can log in even from another user on the server where MySQL is installed, or through an SSH tunnel from another computer (for example with MySQL Workbench).