使用MySQL8无需像MySQL5那样需要Boost依赖,和经过35-55分钟的等待编译完成,直接解压即可使用,方便快捷!
1,环境:
操作系统 CentOS Linux release 7.6.1810 (Core) 64位
服务器环境 “腾讯云”服务器
cat /etc/centos-release # 查看centos系统版本
MySQL8.0.15源码包下载地址
2,执行以下命令,一键安装MySQL8
mkdir -p /data/soft/ # 创建安装目录
cd /data/soft/ # 打开安装目录
yum -y install wget gcc gcc-c++ ncurses ncurses-devel cmake numactl.x86_64 # 安装相应依赖库
wget https://downloads.mysql.com/archives/get/file/mysql-8.0.13-el7-x86_64.tar.gz
# 下载源码包
tar -zxvf /data/soft/mysql-8.0.15-el7-x86_64.tar.gz -C /data/soft # 解压源码包到安装目录
mv /data/soft/mysql-8.0.15-el7-x86_64/ /data/soft/mysql/ # 重命名安装目录
cd /data/soft/mysql/ # 打开安装目录
cp /data/soft/mysql/support-files/mysql.server /etc/init.d/mysql #添加到服务启动cat >/etc/my.cnf <<EOF # 配置mysql数据库
[client]
port=3306
socket=/tmp/mysql.sock
[mysqld]
port=3306
socket=/tmp/mysql.sock
skip-external-locking
key_buffer_size = 16M
max_allowed_packet = 1M
table_open_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
basedir=/data/soft/mysql
datadir=/var/lib/mysql
EOFmkdir -p /var/lib/mysql
chmod -R 777 /var/lib/mysql
mkdir /var/log/mariadb
chown -R 777 /var/log/mariadb/
touch /var/log/mariadb/mariadb.log
mkdir /var/run/mariadb
chown -R 777 /var/run/mariadb/
touch /var/run/mariadb/mariadb.pid
# 赋予对应目录权限mv /var/lib/mysql/ /var/lib/mysql_bak/cat >> /etc/profile << EOF
export PATH=\$PATH:/data/soft/mysql/bin:/data/soft/mysql/lib
EOFsource /etc/profile # 增加到环境变量useradd mysql # 添加mysql用户
/data/soft/mysql/bin/mysqld --defaults-file=/etc/my.cnf --user=mysql --initialize-insecure # 初始化mysql
/etc/init.d/mysql start # 启动mysql