How to Install MySQL on Ubuntu 22.04 | Holhol24


MySQL is a price relational database control gadget from Oracle, and it’s launched underneath the GPL (General Public License).

It used to be to begin with advanced by way of a Swedish corporate, MySQL AB,  and is now owned and advanced by way of the Oracle Corporation.

This article will display tips on how to set up MySQL on Ubuntu 22.04.

Install MySQL Server on Ubuntu 22.04

Install MySQL 8.0 on Ubuntu 22.04

MySQL database applications are to be had thru Oracle’s legit repository. So, first, obtain the MySQL repository setup package deal for Ubuntu.


Then, set up the repository package deal utilizing the dpkg command.

sudo dpkg -i mysql-apt-config_0.8.23-1_all.deb

MySQL model 8.0 is the default variety for the repository’s configuration. Use the down arrow to make a choice OK after which press Enter.

And then replace the repository index utilizing the apt command.

sudo apt replace

Finally, run the next command to put in MySQL server 8.0.

sudo apt set up -y mysql-community-server

The package deal installer will recommended you to,

1. Enter MySQL root password

2. Re-Enter MySQL root password

3. Choose Authentication Method

Use Strong Password Encryption (RECOMMENDED): MySQL will use a brand new authentication in line with the SHA256 password strategies. If you select this technique, simplest the newest model of purchasers and connectors with caching_sha2_password improve can hook up with the MySQL server.

Use Legacy Authentication Method (Retain MySQL 5.x Compatibility): MySQL will use the outdated authentication means (mysql_native_password), which all purchasers and connectors improve.

Install MySQL 5.7 on Ubuntu 22.04

MySQL 5.7 applications aren’t to be had for Ubuntu 22.04. So, you’ll be able to no longer set up MySQL server 5.7 on Ubuntu 22.04.

Manage MySQL Server Service

After putting in the MySQL server, run the underneath command to test the standing MySQL database carrier.

sudo systemctl standing mysql


 mysql.carrier - MySQL Community Server
     Loaded: loaded (/lib/systemd/gadget/mysql.carrier; enabled; supplier preset: enabled)
     Active: energetic (operating) since Sun 2022-07-31 02:14:51 EDT; 24s in the past
       Docs: guy:mysqld(8)
   Main PID: 5548 (mysqld)
     Status: "Server is operational"
      Tasks: 39 (restrict: 4624)
     Memory: 357.0M
        CPU: 779ms
     CGroup: /gadget.slice/mysql.carrier
             └─5548 /usr/sbin/mysqld

Jul 31 02:14:50 ubuntu-2204 systemd[1]: Starting MySQL Community Server...
Jul 31 02:14:51 ubuntu-2204 systemd[1]: Started MySQL Community Server.

You can forestall/get started/restart the MySQL server carrier with the underneath instructions.

sudo systemctl forestall mysql

sudo systemctl get started mysql

sudo systemctl restart mysql

Login to MySQL Server

Login to the MySQL database server with the MySQL root consumer and the password you put all the way through set up.

mysql -u root -p


Welcome to the MySQL track.  Commands finish with ; or g.
Your MySQL connection identity is 8
Server model: 8.0.30 MySQL Community Server - GPL

Copyright (c) 2000, 2022, Oracle and/or its associates.

Oracle is a registered trademark of Oracle Corporation and/or its
associates. Other names could also be logos in their respective
house owners.

Type 'lend a hand;' or 'h' for lend a hand. Type 'c' to transparent the present enter commentary.


Install phpMyAdmin

PHPMyAdmin is an internet software for managing MySQL and MariaDB servers over the internet browser. It supplies an interface for acting administrative operations in your database like growing, losing, changing, deleting databases and tables, and many others.

READ: Install phpMyAdmin With Nginx on Ubuntu 22.04


That’s All. I am hoping you may have realized tips on how to set up MySQL on Ubuntu 22.04.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More