I are going to install MySQL server on Ubuntu 19.04, but you can follow the instructions and install MySQL server on Ubuntu 18.04 as well.
First thing first, we need to update the system core..
sudo apt update && upgrade
Wait for the updates and upgradables to be finished and then run MySQL installation command…
sudo apt install mysql-server -y
When MySQL server is installed on your Ubuntu desktop, simply exit out of the terminal and relaunch the terminal and login to MySQL with sudo right.. type –
Now you in the MySQL ternimal interface, here we are now going to alter root password, so that you can login to MySQL with root username and its password.
Alter MySQL root user password
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
Here you should choose a secure password for the root user. Now, let’s flush the privileges
Now, exit out of the MySQL interface and log back in with root user and the altered password.
exit mysql -u root -p
Type root user password and create your very first SQL database with this simple command..
CREATE DATABASE db_name;
Check all the databases, that exist on the SQL database.
If you still can’t install MySQL on Ubuntu, you can watch me install MySQL on my Ubuntu 19.04