How to Install MySQL 8.0 in Linux CentOS/Oracle Linux 8

Introduction

MySQL 8.0 is an open source relational database management system (RDBMS) that is designed to provide a secure and reliable platform for managing data. It is the latest version of the popular MySQL database, and offers a range of features to make data storage and retrieval easier than ever before. This includes improved security, scalability, performance, and more.

What is MySQL 8 and How Does It Compare To Previous Versions?

MySQL 8 offers a wide range of features that make it easier for developers to build and manage databases. Compared to previous versions, MySQL 8 comes with improved scalability, better performance, and enhanced security features. In addition, it has been designed to be more user-friendly and efficient in terms of use cases.

How to Install MySQL 8.0 on Linux

Installing MySQL 8.0 on Linux is a fairly simple process. In this article, we will walk you through the steps required to install MySQL 8.0 on CentOS 8/Oracle Linux 8

1. Install MySQL :

# dnf module -y install mysql:8.0

2. Configure MySQL Database, set default charaset :

# vim /etc/my.cnf.d/mysql-server.cnf

Add the following line under “[mysqld]”

[mysqld]
character-set-server=utf8mb4 

Save the changes.

3. Start MySQL and make it auto start at boot with below command :

# systemctl enable --now mysqld

4. Allow to access MySQL Server from remote Hosts, allow service

# firewall-cmd --add-service=mysql --permanent
# firewall-cmd --reload

5. Secure and run initial settings for MySQL. Read on How to Secure MySQL/MariaDB Database Server :

# mysql_secure_installation

Output

# mysql_secure_installation

Securing the MySQL server deployment.

Connecting to MySQL using a blank password.

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:
Invalid option provided.

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: 0
Please set the password for root here.

New password:

Re-enter new password:

Estimated strength of the password: 50
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success.


Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
Success.

By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.


Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
 - Dropping test database...
Success.

 - Removing privileges on test database...
Success.

Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.

All done!

6. Verify MySQL root login :

# mysql -u root -p

Example of successful login :Install MySQL 8.0 in Linux

See also  How to Detect Poorly Optimized MySQL Queries

Conclusion: Take Advantage Of All The Benefits Of MySQL 8 Today!

MySQL 8 is the latest version of the popular open source database software. It offers a wide range of features and solutions that make it an ideal choice for businesses and organizations looking to manage large amounts of data. With its powerful query optimization, improved storage engine, and enhanced security features, MySQL 8 provides a comprehensive database solution that can be used to maximize performance and scalability. With its easy-to-use graphical user interface, MySQL 8 makes it easy for users to quickly access their data and get the most out of their database. As businesses look to take advantage of all the benefits that MySQL 8 has to offer, they should take advantage of them today!

Leave a Comment