If you setup Ubuntu’s latest LTS version (18.04), and are using the GUI because you want to do more than just run a server, then this might happen to you. I have a root password setup, but apparently this will also happen if you don’t have a root password set for your installation of Ubuntu.
Normally this happens because you’ve decided not to have a password for the “root” user within MySQL/MariaDB, the auth_plugin for MySQL/MariaDB has defaulted to auth_socket. This means that if you type “sudo mysql -uroot -p” and enter your password then you will get in. If you don’t, then this will not work for you. At least it might not.
You need to run the following commands in order to fix the issue and resolve it. Also, make sure you set a password for your development environment.
sudo mysql -uroot -p
mysql> USE mysql;
mysql> UPDATE user SET plugin='mysql_native_password' WHERE User='root';
mysql> FLUSH PRIVILEGES;
sudo systemctl restart mariadb
sudo systemctl status mariadb
So this took me a few minutes to work out, but I’m glad I did. Make sure you don’t get caught out from this issue as well!