Install MySQL 8 on CentOS 8

0
244

This guide will take you through how to install MySQL 8 on CentOS 8. ofof of the famous opensource relational database management system, MySQL.

Install MySQL 8 on CentOS 8

MySQL 8 is available for installation on the AppStream repos for CentOS 8. The AppStream repos are enabled by default.

dnf whatprovides mysql
mysql-8.0.13-1.module_el8.0.0+41+ca30bab6.x86_64 : MySQL client programs and shared libraries
Repo        : AppStream
Matched from:
Provide    : mysql = 8.0.13-1.module_el8.0.0+41+ca30bab6

Hence, MySQL 8 server can simply be installed by running the command below;

dnf install mysql-server

To install MySQL 8 client;

dnf install mysql

To install both MySQL 8 server and client;

dnf install @mysql
...
=======================================================================================================================================================
 Package                                   Arch                  Version                                                Repository                Size
=======================================================================================================================================================
Installing group/module packages:
 mysql-server                              x86_64                8.0.13-1.module_el8.0.0+41+ca30bab6                    AppStream                 25 M
Installing dependencies:
 mariadb-connector-c-config                noarch                3.0.7-1.el8                                            AppStream                 13 k
 mecab                                     x86_64                0.996-1.module_el8.0.0+41+ca30bab6.9                   AppStream                397 k
 mysql                                     x86_64                8.0.13-1.module_el8.0.0+41+ca30bab6                    AppStream                9.2 M
 mysql-common                              x86_64                8.0.13-1.module_el8.0.0+41+ca30bab6                    AppStream                142 k
 mysql-errmsg                              x86_64                8.0.13-1.module_el8.0.0+41+ca30bab6                    AppStream                523 k
 protobuf-lite                             x86_64                3.5.0-7.el8                                            AppStream                150 k
Installing module profiles:
 mysql/server                                                                                                                                         
Enabling module streams:
 mysql                                                           8.0                                                                                  

Transaction Summary
=======================================================================================================================================================
Install  7 Packages

Total download size: 36 M
Installed size: 243 M
Is this ok [y/N]: y

Running MySQL 8 on CentOS 8

Once the installation completes, start and enable MySQL 8 server to run on system boot.

systemctl start mysqld
systemctl enable mysqld

To check the status of MySQL 8 server;

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 Wed 2019-10-02 13:19:32 EDT; 42s ago
 Main PID: 29142 (mysqld)
   Status: "SERVER_OPERATING"
    Tasks: 38 (limit: 11512)
   Memory: 466.4M
   CGroup: /system.slice/mysqld.service
           └─29142 /usr/libexec/mysqld --basedir=/usr

Oct 02 13:19:20 localhost.localdomain systemd[1]: Starting MySQL 8.0 database server...
Oct 02 13:19:20 localhost.localdomain mysql-prepare-db-dir[29057]: Initializing MySQL database
Oct 02 13:19:32 localhost.localdomain systemd[1]: Started MySQL 8.0 database server.

MySQL 8 Initial Security

By default, MySQL ships with security script that is used to remove test MySQL server databases, remove anonymous users in the database, disable remote root login, set the password strength. To run the script, simply execute the command;

mysql_secure_installation

When run, you are prompted whether to enable or disable password policy. If enabled, set the password policy and create the password that matches your chosen policy.

VALIDATE PASSWORD COMPONENT can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD component?

Press y|Y for Yes, any other key for No: y

There are three levels of password validation policy:

LOW    Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary                  file

Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 2
Please set the password for root here.

New password: 

Re-enter new password: 

Estimated strength of the password: 100 
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y

Next, remove anonymous users, disallow remote root login, remove test database and reload privileges tables to effect the changes made.

You can now login to your MySQL 8 server as a root user with the password set above.

mysql -u root -p

To show MySQL version, you can run the query;

show variables like "version%";
+-------------------------+---------------------+
| Variable_name           | Value               |
+-------------------------+---------------------+
| version                 | 8.0.13              |
| version_comment         | Source distribution |
| version_compile_machine | x86_64              |
| version_compile_os      | Linux               |
| version_compile_zlib    | 1.2.11              |
+-------------------------+---------------------+

You can as well run the command below on command line to show database version.

mysql -V
mysql  Ver 8.0.13 for Linux on x86_64 (Source distribution)

That is all on how to install MySQL 8 on CentOS 8.

Similar Tutorials

Install MySQL 8 on Debian 10 Buster

Install LEMP Stack with MySQL 8 on Fedora 30/Fedora 29

Install MySQL 8 on FreeBSD 12

Install MySQL 8 on Debian 9

Install MySQL 8 on Fedora 30/Fedora 29

LEAVE A REPLY

Please enter your comment!
Please enter your name here