1、上传文件
- 上传mysql8deb.tar和mysql8install.sh到任意路径
mysql8deb.tar: 126邮箱下载
# cat mysql8install.sh
#!/bin/bash
echo -e "\033[32mMySQL 8.0.23 begin install...\033[0m"
basedir=$(cd $(dirname $0);pwd)
debs=(
mysql-common_8.0.23-1ubuntu16.04_amd64.deb
mysql-community-client-plugins_8.0.23-1ubuntu16.04_amd64.deb
mysql-community-client-core_8.0.23-1ubuntu16.04_amd64.deb
mysql-community-client_8.0.23-1ubuntu16.04_amd64.deb
mysql-client_8.0.23-1ubuntu16.04_amd64.deb
libmysqlclient21_8.0.23-1ubuntu16.04_amd64.deb
libmysqlclient-dev_8.0.23-1ubuntu16.04_amd64.deb
libaio1_0.3.110-2_amd64.deb
libmecab2_0.996-1.2ubuntu1_amd64.deb
mysql-community-server-core_8.0.23-1ubuntu16.04_amd64.deb
mysql-community-server_8.0.23-1ubuntu16.04_amd64.deb
)
mkdir $basedir/mysqldebs
tar xf mysql8deb.tar -C $basedir/mysqldebs
dpkg-preconfigure $basedir/mysqldebs/${debs[10]}
for ((i=0;i<${#debs[*]};i++)); do
dpkg -i $basedir/mysqldebs/${debs[i]}
done
rm -rf $basedir/mysqldebs
echo -e "\033[32mMySQL 8.0.23 install complete! \033[0m"
echo -e "\033[32mMySQL 8.0.23 begin set character...\033[0m"
echo "character-set-server=utf8" >> /etc/mysql/mysql.conf.d/mysqld.cnf
systemctl restart mysql
systemctl enable mysql
echo -e "\033[32mMySQL 8.0.23 can use now! \033[0m"