Logo
  • Ubuntu
  • CentOS
  • Debian
  • Fedora
  • RedHat

How to Install MySQL on Ubuntu 22.04 - DesignLinux

Nov 27 2022
designlinux 0 Comments
how-to-install-mysql-on-ubuntu-22-04

MySQL is widely used and popular open-source database management system. MySQL installation on Ubuntu is very easy and it’s commonly being a part of the popular LAMP and LEMP stacks. This article shows you how to install MySQL on Ubuntu 22.04 systems.

How to Install MySQL on Ubuntu 22.04#

Perform the following steps as root or sudo user to install MySQL on Ubuntu 22.04 system. At the time of writing this article, the latest Mysql version is 8.0.31 available in the Ubuntu repositories.

Step 1 – Update System Repositories

First, you need to update the index list using below command:

sudo apt update

Step 2 – Install Mysql

In next step, run the below command to install MySQL:

sudo apt install mysql-server

Installation process may take few minutes and It will ask you to set MySQL root user password. MySQL service will start automatically upon the installation complete.

Step 3 – Verify MySQL Installation

You can verify the installation by checking whether the MySQL server is running or not. Issue below command to verify it:

sudo systemctl status mysql

It should show below output if service is active:

● mysql.service - MySQL Community Server
      Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
      Active: active (running) since Thr 2022-11-24 01:25:44 UTC; 5min 7s ago
    Main PID: 6260 (mysqld)
      Status: "Server is operational"

Step 4 – Secure MySQL Installation

In this step we will execute MySQL inbuilt security script to improve MySQL security. Execute the mysql_secure_installation command:

sudo mysql_secure_installation

It will prompt you to enter root user password which you set before this step. After that, it will ask you to choose whether to use the VALIDATE PASSWORD PLUGIN or not, which can be used to test the strength of your MySQL password. Press ENTER if you don’t want to set up the validate password plugin.

Next, It will ask if you want to change current root user password. If your current password is perfect then, enter N for No at the prompt.

Now, for all next questions press Y and hit Enter key for each. This will remove some anonymous users and test database, disable remote root logins and load these new rules so that MySQL immediately respects the changes you have made. Following questions will be prompted and you have to press yes/y for all :

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y

Step 5 – Connect to MySQL

You can login to MySQL server using command line using below command:

mysql -u root -p

It will prompt to enter root user password which you set before and it will show you output as below:

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 8.0.31 MySQL Community Server - GPL

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

Conclusion#

It’s very straightforward to to install MySQL and Secure MySQL on Ubuntu 22.04 Jemmy Jellyfish system.

If you are facing any issue, feel free to leave a comment below.

Related

Tags: database, mysql, ubuntu

How to Install Google Chrome on Ubuntu 22.04

Prev Post

How to Install MySQL on Debian 11

Next Post
Archives
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • July 2022
  • June 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020
  • June 2020
  • May 2020
Categories
  • AlmaLinux
  • Android
  • Ansible
  • Apache
  • Arch Linux
  • AWS
  • Backups
  • Bash Shell
  • Bodhi Linux
  • CentOS
  • CentOS Stream
  • Chef
  • Cloud Software
  • CMS
  • Commandline Tools
  • Control Panels
  • CouchDB
  • Data Recovery Tools
  • Databases
  • Debian
  • Deepin Linux
  • Desktops
  • Development Tools
  • Docker
  • Download Managers
  • Drupal
  • Editors
  • Elementary OS
  • Encryption Tools
  • Fedora
  • Firewalls
  • FreeBSD
  • FTP
  • GIMP
  • Git
  • Hadoop
  • HAProxy
  • Java
  • Jenkins
  • Joomla
  • Kali Linux
  • KDE
  • Kubernetes
  • KVM
  • Laravel
  • Let's Encrypt
  • LFCA
  • Linux Certifications
  • Linux Commands
  • Linux Desktop
  • Linux Distros
  • Linux IDE
  • Linux Mint
  • Linux Talks
  • Lubuntu
  • LXC
  • Mail Server
  • Manjaro
  • MariaDB
  • MongoDB
  • Monitoring Tools
  • MySQL
  • Network
  • Networking Commands
  • NFS
  • Nginx
  • Nodejs
  • NTP
  • Open Source
  • OpenSUSE
  • Oracle Linux
  • Package Managers
  • Pentoo
  • PHP
  • Podman
  • Postfix Mail Server
  • PostgreSQL
  • Python
  • Questions
  • RedHat
  • Redis Server
  • Rocky Linux
  • Security
  • Shell Scripting
  • SQLite
  • SSH
  • Storage
  • Suse
  • Terminals
  • Text Editors
  • Top Tools
  • Torrent Clients
  • Tutorial
  • Ubuntu
  • Udemy Courses
  • Uncategorized
  • VirtualBox
  • Virtualization
  • VMware
  • VPN
  • VSCode Editor
  • Web Browsers
  • Web Design
  • Web Hosting
  • Web Servers
  • Webmin
  • Windows
  • Windows Subsystem
  • WordPress
  • Zabbix
  • Zentyal
  • Zorin OS
Visits
  • 0
  • 687
  • 615,059

DesignLinux.com © All rights reserved

Go to mobile version