How to Install MySQL in Ubuntu Linux
Outcome: This tutorial teaches you to Install MySQL inn Ubuntu based Linux Distro. You'll also learn how to verify your installation and how to connect to MySQL.
MySQL is the ultimate database management system. It is used in almost every stacks. MySQL is an open source database management system.
MySQL uses tabular data , also known as relational database. It means all the data is stored in the tabular form to access data easily and organise. For managing the data SQL ( structured query language ) is used.
Installing MySQL :
There are two methods
1) Install from Ubuntu repositories
first make sure your all repositories are updated, run below command
sudo apt update or use sudo apt-get update
Now install MySQL
sudo apt install mysql-server -y
2) Installing MySQL using the official repository
Go to this link and download the DEB package
Now it's time the sending the request. Open the terminal and type following command to download the package:
curl -OL https://dev.mysql.com/get/mysql-apt-config_0.8.12-1_al.deb
Now to start installation use dpkg command
sudo dpkg -i mysql -apt-config*
Now you will see the package configuration in your terminal
Now go to ok and press ENTER
Now enter password for it and again press ok.
Now you have successfully installed MySQL
VERIFY YOUR MYSQL INSTALLATION :
run below command :
sudo systemctl status mysql.service
You'll see the Active status in the terminal
To start the service use following command :
sudo systemctl start mysql.service
How to run the Queries in MySQL
To run the queries you need to the first connect to the server using MySQL.
so to do that run the following command
mysql -h host_name -u user -p
you can directly enter your password , to skip the entering password step.
by using following command:
mysql -u test_user -p9876
where 9876 is password.
Now you are in the MySQL database management system.
To disconnect from the server and leave the prompt,type:
QUIT or /q
If you need any kind of help about the MySQL type