# 解压
tar xvJf mysql-8.0.30-linux-glibc2.12-x86_64.tar.xz
# 改名
mv mysql-8.0.30-linux-glibc2.12-x86_64 mysql-8.0.30
cd mysql-8.0.30 ; mkdir data ; mkdir log ; mkdir tmp
cd log ; touch mysqld.log
# 增加mysql用户
groupadd mysql
useradd -g mysql mysql
cd ..
# 授权给mysql
chown -R mysql.mysql ./mysql-8.0.30
# 初始化
./bin/mysqld --initialize --user=mysql --basedir=/data/software/mysql-8.0.30 --datadir=/data/software/mysql-8.0.30/data
# 编辑配置文件/etc/my.cnf
# 配置环境变量
vim /etc/profile
MYSQL_HOME=/data/software/mysql-8.0.30
PATH=$PATH:$MYSQL_HOME/bin
source /etc/profile
# 启动mysql服务
./support-files//mysql.server start
my.cnf
[client]
port=3306
socket=/data/software/mysql-8.0.30/mysql.sock
[mysqld]
basedir=/data/software/mysql-8.0.30
datadir=/data/software/mysql-8.0.30/data
socket=/data/software/mysql-8.0.30/mysql.sock
max_connections=1000
group_concat_max_len=102400000
skip-name-resolve
slow-query_log=ON
slow_query_log_file=/data/software/mysql-8.0.30/log/mysql-slow.log
long_query_time=2
innodb_file_per_table = 1
character-set-server=utf8mb4
collation-server=utf8mb4_general_ci
init_connect='SET NAMES utf8mb4'
[log]
log_bin=/data/software/mysql-8.0.30/log/mysql-bin
binlog_format=ROW
expire_logs_days=5
[mysqld_safe]
log-error=/data/software/mysql-8.0.30/log/mysqld.log
pid-file=/data/software/mysql-8.0.30/mysqld.pid
mysql8安装教程
不使用useradd添加linux用户