Install MySQL Server 8 on CentOS 7

Install MySQL Server 8 pada CentOS 7

  • Download repository mysql 8.0 community server
rpm -Uvh https://repo.mysql.com/mysql80-community-release-el7-5.noarch.rpm
  • Cek versi mysql yang akan di install
yum info mysql-community-server
---<output>---
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.biznetgio.com
 * epel: repo.ugm.ac.id
 * extras: mirror.gi.co.id
 * remi-php81: cdn.centos.no
 * remi-safe: cdn.centos.no
 * updates: mirror.gi.co.id
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         : http://www.mysql.com/
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
---<output>---
[Note] [MY-010454] [Server] A temporary password is generated for root@localhost: t21306PZpl/U
  • Jalankan mysql secure installation
mysql_secure_installation
---<output>---
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
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! 
  • Cek versi mysql
mysql -V
---<output>---
mysql  Ver 8.0.34 for Linux on x86_64 (MySQL Community Server - GPL)
  • Masuk ke dalam mysql server
mysql -u root -p
---<output>---
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
owners.

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
Bye

herdiana3389

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