sajad torkamani

Note: The following instructions assume that no versions of MySQL (whether distributed by Oracle or other parties) have already been installed on your system; if that is not the case, follow the instructions given in Replacing a Native Distribution of MySQL Using the MySQL APT Repository or Replacing a MySQL Server Installed by a Direct deb Package Download instead.

Add the MySQL APT repository

Go to this link.

Run:

cd /tmp && wget <copied-link>

Then, install the package and proceed with the installation instructions:

sudo dpkg -i /PATH/version-specific-package-name.deb

Install MySQL package

Update package index:

sudo apt update

Verify the new MySQL version is available:

sudo apt-cache show mysql-community-server

You should see something like:

Install MySQL 8.4.0 on Ubuntu 22.04

Install package:

sudo apt-get install mysql-community-server

Secure installation

sudo mysql_secure_installation

Enter a strong password (use a tool like LastPass or this) and save this password somewhere. Press Enter for the remaining prompts to accept the sane defaults.

Verify installation

sudo mysql

This should log you into the MySQL server as the root user. If setting up MySQL on a production server, you’ll want to create a separate MySQL user with restricted access for each application.

Sources

Tagged: MySQL