1、官网下载mysql安装包
https://downloads.mysql.com/archives/community/
2、解压安装包
tar -zxvf mysql-8.1.0-linux-glibc2.28-aarch64.tar.xz -C /usr/local
mv /usr/local/mysql-8.1.0-linux-glibc2.28-aarch64 /usr/local/mysql
3、创建mysql用户组
groupadd mysql
ueradd -r -g mysql mysql
chmod ug+rwx /data/mysql/*
chown mysql:mysql -R /data/mysql/*
4、创建数据存储目录
mkdir -p /data/mysql/3310
mkdir -p /data/mysql/3311
5、初始化数据库
/usr/local/mysql/bin/mysqld --initialize-insecure --datadir=/data/mysql/3310/data --user=mysql
/usr/local/mysql/bin/mysqld --initialize-insecure --datadir=/data/mysql/3311/data --user=mysql
6、实例启动配置文件
3310的配置
cat >> /data/mysql/3311/my.cnf << EOF
[mysqld]
bind-address=0.0.0.0
port=3310
basedir=/usr/local/mysql
datadir=/data/mysql/3310/data
socket=/data/mysql/3310/mysql.sock
log-bin=/data/mysql/3310//data/mysql-bin
server-id=3310
[mysqld_safe]
log-error=/data/mysql/3310/mysqld_error.log
pid-file=/data/mysql/3310/mysqld.pid
EOF
3311的配置
cat >> /data/mysql/3311/my.cnf <<
[mysqld]
bind-address=0.0.0.0
port=3311
basedir=/usr/local/mysql
datadir=/data/mysql/3311/data
socket=/data/mysql/3311/mysql.sock
log-bin=/data/mysql/3311//data/mysql-bin
server-id=3311
[mysqld_safe]
log-error=/data/mysql/3311/mysqld_error.log
pid-file=/data/mysql/3311/mysqld.pid
EOF
7、启动数据库实例
启动3310
/usr/local/mysql/bin/mysqld_safe --defaults-file=/data/mysql/3310/my.cnf 2>&1 > /var/log/mysql3310.log &
启动3311
/usr/local/mysql/bin/mysqld_safe --defaults-file=/data/mysql/3311/my.cnf 2>&1 > /var/log/mysql3311.log &
检测启动状态
ps -ef | grep msyqld
8、客户端连接测试
/usr/local/mysql/bin/mysql -h 127.0.0.1 -P 3310 -u root
/usr/local/mysql/bin/mysql -h 127.0.0.1 -P 3311 -u root
设置root密码
update user set authentication_string="root!2018LC" where user="root"