How to Install MySQL on CentOS 8 / RHEL 8 / Oracle Linux 8

December 01, 2022 ・0 comments

In this quick guide, i will show you how to install MYSQL on CentOS 8 / RHEL 8 / Oracle Linux 8 instead of MariaDB.

MariaDB is the default implementation of MySQL in Red Hat Enterprise Linux 8 (RHEL 8) or CentOS 8.

MariaDB is a community-developed fork of the MySQL database project, and provides a replacement for MySQL.

However, in some cases, you still need to install MySQL as your deployment database on you Linux server.

Remove MariaDB installation :

If you server already have MariaDB database server installed, i would suggest you remove it first to avoid conflict.

[root@localhost ~]# sudo yum remove mariadb-server -y

2. Download MySQL 8.0 repo file :

[root@localhost ~]# wget https://dev.mysql.com/get/mysql80-community-release-el8-4.noarch.rpm

3. Install MySQL 8 repo file :

[root@localhost ~]# sudo rpm -ivh mysql80-community-release-el8-4.noarch.rpm

4. Install MySQL 8 database server :

[root@localhost ~]# sudo yum install mysql-server -y

Install MySQL on CentOS 8


5. How to Start MySQL server in linux :

[root@localhost ~]# sudo systemctl start mysqld

6. Enable auto start at boot :

[root@localhost ~]# sudo systemctl enable mysqld

7. At the initial start up of the MySQL database server, the following happens, given that the data directory of the server is empty:

a) The server is initialized.

b) An SSL certificate and key files are generated in the data directory.

c) The validate_password plugin is installed and enabled.

d) A superuser account ‘root’@’localhost is created. The initial root password created can be found in the error log file. You can get the password by issue the following command :

[root@localhost ~]# sudo grep 'temporary password' /var/log/mysqld.log

2016-06-19T23:08:09.439963Z 1 [Note] A temporary password is generated for root@localhost: sj-mMM;o%6Ll

8. Harden MySQL Server

Run the mysql_secure_installation script to address several security concerns in a default MySQL installation.

You will be given the choice to change the MySQL root password, remove anonymous user accounts, disable root logins outside of localhost, and remove test databases. It is recommended that you answer yes to these options.

Install MySQL on CentOS 8 Result

Resource : http://dev.mysql.com/

Post a Comment

If you can't commemt, try using Chrome instead.