Installing MySQL on Ubuntu

Installing MySQL on Ubuntu

1 Comment

Last Updated on October 21, 2024 by jt

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.

apt search mysql

To install MySQL included in the APT repository:

    1. Update the package index on your server
sudo apt-get update
    1. Install the package
sudo apt-get install mysql-server-5.6

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.
wget http://dev.mysql.com/get/mysql-apt-config_0.6.0-1_all.deb
    1. Go through the prompt to select and apply the specific MySQL version to install.
    2. Update the package index on your server.
sudo apt-get update
    1. Install the package.
sudo apt-get install mysql-server

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

service mysql status

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

sudo service mysql stop

To start MySQL, run the following command:

sudo service mysql start

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

About jt

    You May Also Like

    One comment

    1. April 28, 2020 at 1:55 am

      Thanks for the resource !

      Reply

    Leave a Reply

    Your email address will not be published. Required fields are marked *

    This site uses Akismet to reduce spam. Learn how your comment data is processed.