摘要:1.安装取决于yu_install syncurses devellibaio develglibcacoutonensslopenssl-devel2.安装cmakecdwgethttps://github.com/Kitware/CMake/releases/download/v3.19.0-rc3/cmake-3.19.0-rc3-Linux-x86_64.shshcmake-3.19.0
1.安装依赖
yum install -y ncurses-devel libaio-devel glibc autoconf openssl openssl-devel
2.安装cmake
cd
wget https://github.com/Kitware/CMake/releases/download/v3.19.0-rc3/cmake-3.19.0-rc3-Linux-x86_64.sh
sh cmake-3.19.0-rc3-Linux-x86_64.sh
# 一路回车 两个y
mv cmake-3.19.0-rc3-Linux-x86_64 /usr/local/
添加环境变量并生效
cat >> /etc/profile <<'EOF'
PATH=$PATH:/usr/local/cmake-3.19.0-rc3-Linux-x86_64/bin
EOF
source /etc/profile
3.安装c++ cc
#添加scl源 下载编译工具
yum install centos-release-scl scl-utils-build -y
yum install devtoolset-7-gcc.x86_64 devtoolset-7-gcc-c++.x86_64 devtoolset-7-gcc-gdb-plugin.x86_64 -y
#切换环境
scl enable devtoolset-7 bash
gcc -v
rm -rf /usr/bin/{c++,cc}
ln -s /opt/rh/devtoolset-7/root/usr/bin/c++ /usr/bin/c++
ln -s /opt/rh/devtoolset-7/root/usr/bin/cc /usr/bin/cc
4.下载解压
wget https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-boost-8.0.21.tar.gz
mkdir -p /data/mysql
mkdir -p /usr/local/mysql
tar -zxf mysql-boost-8.0.21.tar.gz -C /usr/local
5.生成
cd /usr/local/mysql-8.0.21
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data -DSYSCONFDIR=/etc -DMYSQL_TCP_PORT=3306 -DWITH_BOOST=/usr/local/mysql-8.0.21/boost -DFORCE_INSOURCE_BUILD=1
6.修改代码
vim ./extra/libedit/libedit-20190324-3.1/src/terminal.c
/*char buf[TC_BUFSIZE];*/ # 注释掉
char *area;
const struct termcapstr *t;
sigset_t oset, nset;
int lins, cols;
(void) sigemptyset(&nset);
(void) sigaddset(&nset, SIGWINCH);
(void) sigprocmask(SIG_BLOCK, &nset, &oset);
area = NULL; # 改为NULL
7.编译安装
make && make install
8.配置MySQL
cat >> /etc/profile <<'EOF'
PATH=$PATH:/usr/local/mysql/bin
EOF
source /etc/profile
useradd mysql -s /sbin/nologin -M
cd /usr/local/mysql/
mysqld --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql/data --initialize # 记住结尾的密码
vim /etc/my.cnf
[mysqld]
datadir=/data/mysql/data
socket=/tmp/mysql.sock
[mysqld_safe]
log-error=/data/mysql/data/mysql.log
pid-file=/data/mysql/data/mysql.pid
vim /usr/lib/systemd/system/mysqld.service
[Unit]
Description=MySQL Server
Documentation=man:mysqld(8)
Documentation=https://dev.mysql.com/doc/refman/en/using-systemd.html
After=network.target
After=syslog.target
[Install]
WantedBy=multi-user.target
[Service]
User=mysql
Group=mysql
ExecStart=/usr/local/mysql/bin/mysqld --defaults-file=/etc/my.cnf
LimitNOFILE = 5000
systemctl daemon-reload
9.启动MySQL
systemctl start mysql
10.修改密码 (必须)
mysqladmin -uroot -p默认密码 password 你要的密码