YouTube Icon

Code Playground.

How to Install MySQL on CentOS 8


How to Install MySQL on CentOS 8

MySQL is the most well known open-source social information base administration framework. 

The most recent rendition of the MySQL information base worker, variant 8.0, is accessible for establishment from the default CentOS 8 stores. 

MySQL 8.0 presented numerous new highlights and changes which made a few applications contrary with this variant. Prior to picking the MySQL form to introduce, counsel the documentation of the application you will convey on your CentOS worker. 

CentOS 8 additionally gives MariaDB 10.3, which is "drop-in substitution" for MySQL 5.7, with certain restrictions. In the event that your application isn't viable with MySQL 8.0 introduce MariaDB 10.3. 

In this instructional exercise, we will tell you the best way to introduce and make sure about MySQL 8.0 on CentOS 8 frameworks. 

Installing MySQL 8.0 on CentOS 8

Introduce the MySQL 8.0 worker by utilizing the CentOS bundle director as root or client with sudo advantages : 

sudo dnf install @mysql

The @mysql module introduces MySQL and all conditions. 

When the establishment is finished, start the MySQL administration and empower it to naturally begin on boot by running the accompanying order: 

sudo systemctl enable --now mysqld

To check whether the MySQL worker is running, type: 

sudo systemctl status mysqld
? mysqld.service - MySQL 8.0 database server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active: active (running) since Thu 2019-10-17 22:09:39 UTC; 15s ago

Securing MySQL

Run the mysql_secure_installation content that plays out a few security-related activities and sets the MySQL root secret key: 

sudo mysql_secure_installation

You will be approached to arrange the VALIDATE PASSWORD PLUGIN , which is utilized to test the quality of the MySQL clients' passwords and improve the security. There are three degrees of secret word approval strategy, low, medium, and solid. Press ENTER on the off chance that you would prefer not to set up the approve secret key module. 

On the following brief, you will be approached to set a secret word for the MySQL root client. When you do that, the content will likewise request that you eliminate the unknown client, confine root client admittance to the nearby machine, and eliminate the test information base. You should answer "Y" (yes) to all inquiries. 

To collaborate with the MySQL worker from the order line, utilize the MySQL customer utility, which is introduced as a reliance. Test the root access by composing: 

mysql -u root -p

Enter the root secret word when incited, and you will be given the MySQL shell as demonstrated as follows: 

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 8.0.17 Source distribution

That is it! You have introduced and made sure about MySQL 8.0 on your CentOS worker, and you're prepared to utilize it. 

Authentication Method

The MySQL 8.0 worker remembered for the CentOS 8 storehouses is set to utilize the old mysql_native_password verification module since some customer devices and libraries in CentOS 8 are not viable with the caching_sha2_password strategy, which is set as default in the upstream MySQL 8.0 delivery. 

mysql_native_password strategy should be fine for most arrangements. Notwithstanding, on the off chance that you need to change the default verification module to caching_sha2_password which is quicker and gives better security, open the accompanying setup document: 

sudo vim /etc/my.cnf.d/mysql-default-authentication-plugin.cnf

Change the estimation of default_authentication_plugin to caching_sha2_password: 


Close and spare record , and restart the MySQL worker for changes to produce results: 

sudo systemctl restart mysqld


CentOS 8 is conveyed with MySQL 8.0. The establishment is as straightforward as composing dnf introduce @mysql. 

Since your MySQL worker is ready for action and you can interface with the MySQL shell, and begin making new information bases and clients . 

In the event that you have any inquiries or criticism, don't hesitate to leave a remark.