How to completely remove mysql from ubuntu:

sudo apt-get remove --purge *mysql\\*
sudo apt-get autoremove
sudo apt-get autoclean

How to install and setup basic MySQL on Ubuntu:

sudo apt-get update
sudo apt-get install mysql-server

Top solve MySQL error: Error: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'

Queries

How to reset root password

sudo service mysql stop
sudo mysqld_safe --skip-grant-tables &
sudo mysql -u root
# oncde in mysql:
use mysql
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'

How to create user and grant privileges:

sudo mysql
CREATE USER 'harper'@'localhost' IDENTIFIED BY 'harper';
GRANT ALL PRIVILEGES ON harper.*  TO 'harper'@'localhost';
CREATE DATABASE webdata;
GRANT ALL ON webdata.* TO 'webuser' IDENTIFIED BY 'password';