Rabu, 13 Maret 2019

Installing MySQL Server 8.0 Community Edition on CentOS 7

This guide is to help you with Installing MySQL 8.0 Community Edition Server on CentOS 7

To start installing MySQL server on CentOS 7, you need to add the official MySQL community repository to your system. Run below commands to add it,

# cd
# wget https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm
# yum localinstall mysql80-community-release-el7-1.noarch.rpm

Install MySQL 8 on CentOS

Now that repo is added, you can install MysQL 8 without editing repository content since repo for 8 is enabled by default.

# yum --enablerepo=mysql80-community install mysql-community-server

Start MySQL Service

For CentOS 7, use systemd to start mysql service:

# systemctl enable  mysqld
# systemctl start mysqld

Harden MySQL Server / Set MySQL root password

Installation of MySQL on CentOS 7 generates a temporary password for you. You can get it by running:

# grep 'temporary password' /var/log/mysqld.log

It will look like below:

temporary password is generated for root@localhost: si=R&3t#Buy7

Change mysql root user password and Harden MySQL

# mysql_secure_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.

Configure Firewall

Firewalld:

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

Test your settings:

[root@webapps3 ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 173142
Server version: 8.0.15 MySQL Community Server (GPL)

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

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>

Tidak ada komentar: