sudo apt-get remove --purge mysql-server mysql-client mysql-common
sudo apt-get autoremove
sudo apt-get autoclean
sudo rm -rf /var/lib/mysql
sudo rm -rf /etc/mysql*
sudo apt-get install mysql-server
sudo /usr/bin/mysql_secure_installation
Change newpassword
to your desired password.
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'newpassword' WITH GRANT OPTION;
FLUSH PRIVILEGES;