The version installed here is mysql-8.0.31-linux-glibc2.12-x86_64.tar.xz
The complete command installation is as follows:
Environment initialization configuration
sudo vim /etc/profile
export MYSQL_HOME=/usr/local/mysql/
export PATH=$MYSQL_HOME/bin:$PATH
The installation commands will now begin.
MYSQL_PKGNAME=mysql-8.0.31-linux-glibc2.12-x86_64.tar.xz
wget https://dev.mysql.com/get/Downloads/MySQL-8.0/${MYSQL_PKGNAME}
tar -xvf ${MYSQL_PKGNAME}
mv mysql-8.0.31-linux-glibc2.12-x86_64 /usr/local/mysql
groupadd mysql
useradd -r -g mysql mysql
chown -R mysql:mysql /usr/local/mysql/
cd /usr/local/mysql
mkdir data
yum -y install numactl.x86_64
ln -s -f /usr/lib64/libtinfo.so.6.2 /usr/lib64/libtinfo.so.5
bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
chown -R root:root ./
chown -R mysql:mysql data
mkdir /etc/init.d
cp ./support-files/mysql.server /etc/init.d/mysqld
cp /opt/sh/.mysql.cnf /etc/my.cnf
chown 777 /etc/my.cnf
chmod +x /etc/init.d/mysqld
/etc/init.d/mysqld restart
source /etc/profile
echo "change rootpwd"
printf "source /opt/sh/.mysql_root_pwd;\n";
service mysqld restart
It is recommended to use the installation command, which will allow for recovery from abnormal situations later.
git clone https://github.com/pixel-jey/mysql-install
sudo \cp -r opt/* /
sudo sudo chown -R root:root /opt/sh/
sudo /opt/sh/myql-config-install.sh
Use: install|rootpwd|mycnf
It mainly provides three functions: installation, root password recovery, and default configuration recovery.
Related AlmaLinux 10 Tutorials
How to Install OpenJDK 21 on AlmaLinux 10
How to Install PHP Binaries on AlmaLinux 10
How to Compile Install PHP on AlmaLinux 10