mysql on ubuntu code example

Example 1: install mysql ubuntu

sudo apt install mysql-server

Example 2: install mysql ubuntu 18.04

sudo apt update
sudo apt install mysql-server
sudo mysql_secure_installation

Example 3: start mysql server linux terminal

sudo /etc/init.d/mysql start
or 
systemctl start mysql.service

Example 4: how to install mysql ubuntu

sudo apt update
sudo apt install mysql-server
sudo service mysql start
sudo mysql_secure_installation
sudo mysql -u root 

In mysql console:
DROP USER 'root'@'localhost';
CREATE USER 'root'@'%' IDENTIFIED BY 'YOURPASSWORD';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;

Example 5: setup mysql ubuntu

sudo apt install mysql-server
sudo mysql_secure_installation utility

Example 6: mysql enter ubuntu

mysql -u root -p