Installing MySQL on Ubuntu

MySQL is the most popular open-source database management system. MySQL uses a relational database and Structured Query Language (SQL) to manage its data.

In this post, I’ll show you how to install MySQL on Ubuntu.

Installing MySQL

There are two ways to install MySQL on Ubuntu. First is to use one of the versions included in the APT package repository by default. Use the following command to find the MySQL version in the APT package repository.

To install MySQL included in the APT repository:

    1. Update the package index on your server

    1. Install the package

During installation, the installer will prompt you to create a root password. Type a secure one and ensure you remember it.

Note: If you are not sure about the version, you can omit the version and run sudo apt-get install mysql-server. This installs the latest version for your Linux distribution.

Installing a Newer MySQL Vwersion

If you want to install the latest MySQL version, such as MySQL 5.7 you’ll need to manually add the MySQL’s repository first. To do so, perform the following steps:

    1. Install the newer APT package repository from the MySQL APT repository page.

    1. Go through the prompt to select and apply the specific MySQL version to install.
    2. Update the package index on your server.

    1. Install the package.

Once installation is complete, MySQL should run automatically. You can check the status of MySQL using the following command.

In order to stop MySQL from the running state, run the following command:

To start MySQL, run the following command:

Refer to the official documentation here for various post-installation setup and configurations of MySQL.

Share

Leave a Reply