Since Ubuntu 18 no longer asks for a password during installation, the following is required. Do the following and follow all steps – this will set the root password for the console:
In order to be able to log in via a CMS or Phpmyadmin, the following is necessary:
Add a new user (replace root with another username and replace password with your password):
ALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'password';
Note: The previous ALTER USER statement configures the MySQL root user to be authenticated with the caching_sha2_password plugin. According to the official MySQL documentation, caching_sha2_password is MySQL’s preferred authentication plugin because it provides more secure password encryption than the older but still widely used mysql_native_password plugin.
However, many PHP applications (for example phpMyAdmin) do not work reliably with caching_sha2_password. If you want to use this database with a PHP application, you may want to set root to authenticate with mysql_native_password instead:
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
Reload the user tables:
You can now log in to phpmyadmin with your username and password.