How to Install MySQL in Ubuntu

Sohail
Sohail

Table of Contents

The Internet is a wild animal. Hungry enough to consume all the data in the world, and still be left wanting for more. Internet was very different earlier. The demand and supply for data was fulfilled in mostly using files that were often manually created.

But once enough people were on the internet, the need for data was getting out of manual control. This led to the usage of database systems in websites and application.​

One of the oldest, most popular and widely used database systems is SQL(Structured Query Language). SQL is more of a standard than a particular system. It is a query language that defines various operations in an RDBMS (Relational Database Management System). It forms the base for tens of popular database technologies.

Some of these are MySQL, PostgreSQL, Microsoft SQL Server, Derby, SQLite, etc. Though they may have a lot of differences in terms of features, they are more or less similar in terms of usage. So we will be discussing MySQL and installing the same on our machines.  

What is MySQL

MySQL is an open source database management system built upon SQL standards. It is estimated that over 60% of the websites and applications on the internet use MySQL. That is a big number and hence learning MySQL seems to be one of the things that will really be helpful to anyone planning a career in the technology.  

Installing MySQL

MySQL installation is fairly simple. Just head over this page and select your appropriate platform. Then you can download the MySQL binaries.  

Install MySQL On Ubuntu

Installing MySQL on Ubuntu is fairly easy. You can download the deb package from the above link or you can just install it via apt –

sudo apt install mysql-server.
install mysql server on ubuntu

Once the installation starts, you will be asked to give a root password. You can give any password of choice. I am setting the password as root, so it’s easy for me to remember.

mysql server root password

You will then be asked to re-enter the password, so do that as well. Once this process completes, you can check your connection to the mysql-server by mysql -uroot -proot. It should give you the following output.

run mysql on terminal

If you get a similar output as the image above, Congratulations. You have successfully installed MySQL on your computer.  

Install MySQL On Windows

Windows users can download the binary as per their system and platform from this page. Once the download is complete just double-click on it to start the installation.

You will be prompted to choose a setup type. You can just select the Full option as a beginner. But people with low hard disk space can select the custom option and we will only install the stuff that’s needed. ​

install mysql on windows

On the next screen, we will select the two important components that are bare minimum needed to learn MySQL. They are the mysql-server and the shell.

install mysql server on windows 10

Once you are done selecting these two things, just click on next. Then you will be shown some dependencies that are missing. Select the dependency and hit execute. This will automatically install them to your system. Once this is done, click next. ​

check system requirement for mysql

You will now be shown the packages you had selected for installation, just click on execute to install them to your system.

mysql installer

Keep hitting next to every other screen as it is best to leave most of it as default. When you encounter the Account and roles screen you will be asked to set a password. Set the password as root as it will be easy to remember for now.

mysql accounts and roles

Click next on a few more screens and finally hit execute on the last screen.

To start mysql command line, just search for mysql and launch the mysql command line client. It will ask you for a password. Type in the password that you gave during installation, root for me, you should see the following screen –

mysql command line client

Done, you have installed MySQL on your computer.  

Other Operating Systems

The installation procedure is similar to other operating systems as well. Most Linux users can download packages for their platforms. But I would suggest you install it from your operating system’s repositories. Mac Users can also install it in the same way as windows users with their .dmg package. I suggest Mac Users read this for installation.  

Conclusion

MySQL is a very famous database system built upon the SQL standards. So this is how to install MySQL in Ubuntu, Windows and other systems. Now we can start learning MySQL.​If you faced any kind of problems while installation, do let me know in the comment section below.

MySQL seriesUncategorizedhow-to