Install MySQL Server 8 on CentOS 7

Install MySQL Server 8 pada CentOS 7

  • Download repository mysql 8.0 community server
rpm -Uvh
  • Cek versi mysql yang akan di install
yum info mysql-community-server
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base:
 * epel:
 * extras:
 * remi-php81:
 * remi-safe:
 * updates:
Available Packages
Name        : mysql-community-server
Arch        : x86_64
Version     : 8.0.34
Release     : 1.el7
Size        : 64 M
Repo        : mysql80-community/x86_64
Summary     : A very fast and reliable SQL database server
URL         :
License     : Copyright (c) 2000, 2023, Oracle and/or its affiliates. Under GPLv2 license as shown in the Description field.
  • Install MySQL 8.0 Community Server
yum install mysql-community-server -y
  • Aktifkan service mysqld
systemctl enable --now mysqld
systemctl status mysqld
  • Cek temporary root password mysql server
grep "A temporary password" /var/log/mysqld.log
[Note] [MY-010454] [Server] A temporary password is generated for root@localhost: t21306PZpl/U
  • Jalankan mysql secure installation
Securing the MySQL server deployment.
Enter password for user root: (masukan temporary root password)

The existing password for the user account root has expired. Please set a new password.
New password: (buat password baru)
Re-enter new password: 
The 'validate_password' component is installed on the server.
The subsequent steps will run with the existing configuration
of the component.
Using existing password for root.

Estimated strength of the password: 100 
Change the password for root ? ((Press y|Y for Yes, any other key for No) : N
 ... skipping.
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

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
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
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

Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
 - Dropping test database...
 - Removing privileges on test database...
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
All done! 
  • Cek versi mysql
mysql -V
mysql  Ver 8.0.34 for Linux on x86_64 (MySQL Community Server - GPL)
  • Masuk ke dalam mysql server
mysql -u root -p
Enter password: (masukan passwrd mysql)
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 448
Server version: 8.0.34 MySQL Community Server - GPL

Copyright (c) 2000, 2023, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
| Database           |
| information_schema |
| mysql              |
| performance_schema |
| sys                |
4 rows in set (0.00 sec)

mysql> exit


A system administrator with skills in system administration, virtualization, linux, windows, networking, cloud computing, container, etc.