Source: https://www.cyberciti.biz/faq/how-to-install-mysql-server-on-centos-8-linux/
To update CentOS system to apply security updates and fixes on Linux system using the yum or dnf command.
> yum update > dnf update
The CentOS 8 box comes with MySQL 8 server package.
> yum install mysql-server
The service name is mysqld.service.
> systemctl enable mysqld.service
To start the service and then verify it.
> systemctl start mysqld.service > systemctl status mysqld.service
All you need to do is type the following command, and it will secure MySQL 8 server installation on CentOS Linux:
> mysql_secure_installation
> systemctl start mysqld.service > systemctl stop mysqld.service > systemctl restart mysqld.service
To view the MySQL 8 service log as follows using the journalctl command:
> journalctl -u mysqld.service -xe > tail -f /var/log/mysql/mysqld.log
It is time to log in as a mysql root user.
> mysql -uroot -p
Let us see default config file using the cat command:
> cat /etc/my.cnf.d/mysql-server.cnf
conf:
[mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock log-error=/var/log/mysql/mysqld.log pid-file=/run/mysqld/mysqld.pid
The location of binlog files can be shown by using the following commands.
> mysql -uroot -p > show binary logs;
The binlog files can be removed by using the following commands.
> RESET MASTER; // remove all binlog files. > PURGE MASTER LOGS to "binlog.000100"; // remove all binlog files before "binlog.000100" > PURGE MASTER LOGS BEFORE "2023-07-28 22:00:00"; // remove all binlog files before 2023-07-28 22:00:00