MySQL Installation on Linux (Ubuntu 22.04 LTS)
MySQL is an open-source relational database management system. In this post we will go through the process to install MySQL on Linux based system (Ubuntu 22.04 LTS).
First of all check for the installation of MySQL, if it is already installed on your version of Linux.
mysql
mysql --version
![](https://cosmictechie.com/wp-content/uploads/2022/09/sql1.webp)
Installing MySQL Server
sudo apt update
![](https://cosmictechie.com/wp-content/uploads/2022/09/sql2.webp)
sudo apt install mysql-server
![](https://cosmictechie.com/wp-content/uploads/2022/09/sql_3.webp)
Check for Service Status
sudo service mysql status
sudo service mysql stop
sudo service mysql start
![](https://cosmictechie.com/wp-content/uploads/2022/09/sql4.webp)
Accessing mysql
sudo mysql
![](https://cosmictechie.com/wp-content/uploads/2022/09/sql5.webp)
sudo mysql directly enters into the root access into mysql.
![](https://cosmictechie.com/wp-content/uploads/2022/09/sql6.webp)
Create a new user
create user 'username'@'localhost' identified by 'password';
grant all privileges on *.* to 'username'@'localhost' with grant option;
flush privileges;
![](https://cosmictechie.com/wp-content/uploads/2022/09/sql7.webp)
Login using new user
mysql -u username -p
![](https://cosmictechie.com/wp-content/uploads/2022/09/sql8.webp)
![](https://cosmictechie.com/wp-content/uploads/2022/09/sql9.webp)