Link: https://dev.mysql.com/downloads/mysql/
Link: https://dev.mysql.com/doc/refman/8.0/en/binary-installation.html
$ groupadd mysql
$ useradd -r -g mysql -s /bin/false mysql
$ cd /mysql/package
$ wget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.31-linux-glibc2.12-x86_64.tar.xz
$ tar xvf /mysql/package/mysql-8.0.31-linux-glibc2.12-x86_64.tar.xz
$ ln -s /mysql/package/mysql-8.0.31-linux-glibc2.12-x86_64 /mysql/mysql
[mysqld]
basedir = /mysql
datadir = /mysql/data
socket = /tmp/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd
log-bin = /mysql/log/mysql-bin
relay-log = /mysql/log/relay-log
slow_query_log_file = /mysql/log/slow.log
general_log_file = /mysql/log/general.log
log-error = /mysql/log/mysql.err
lc_messages_dir = /mysql/mysql/share
[mysqld_safe]
log-error =/mysql/log/mysql.err
pid-file =/mysql/run/mysql.pid
#
# include all files from the config directory
#
!includedir /etc/my.cnf.d
$ cd /mysql/mysql
$ mkdir mysql-files
$ chown mysql:mysql mysql-files
$ chmod 750 mysql-files
$ mkdir -p /mysql/log
$ mkdir -p /mysql/data
$ mkdir -p /mysql/run
$ chown -R mysql:mysql /mysql
$ bin/mysqld --initialize --user=mysql
$ cat /mysql/log/mysql.err | grep temporary
2023-01-03T05:07:15.131791Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: tG33hh<M!#mT
$ bin/mysqld_safe --user=mysql &
$ bin/mysql -p'tG33hh<M!#mT' -uroot
SQL> ALTER USER root@localhost identified with mysql_native_password by 'mysql';