华为云鲲鹏编译mysql文档
华为云鲲鹏编译mysql文档
软件: mysql 5.7.29
标签: centos arm huawei 华为 鲲鹏 kunpeng aarch64 mysql
区域: 贵阳一 可用区1
规格: 鲲鹏通用计算增强型 | kc1.2xlarge.2 | 8vCPUs | 16GB
镜像: CentOS 7.6 64bit with ARM
人员: 童安安
邮箱: tonganan@myhuawei.cn
时间: 2020年08月12日 广州
版本: 2020081201
密级: 文档
==================================================================================================================================================================
Package Arch Version Repository Size
==================================================================================================================================================================
cmake aarch64 2.8.12.2-2.el7 base 6.8 M
ncurses-devel aarch64 5.9-14.20130511.el7_4 base 712 k
openssl-devel aarch64 1:1.0.2k-19.el7 base 1.5 M
openssl-perl aarch64 1:1.0.2k-19.el7 base 71 k
openssl-pkcs11 aarch64 0.4.10-1.el7 epel 58 k
openssl-static aarch64 1:1.0.2k-19.el7 base 1.0 M
keyutils-libs-devel aarch64 1.5.8-3.el7 base 37 k
krb5-devel aarch64 1.15.1-46.el7 base 272 k
libarchive aarch64 3.1.2-14.el7_7 base 294 k
libcom_err-devel aarch64 1.42.9-17.el7 base 31 k
libkadm5 aarch64 1.15.1-46.el7 base 175 k
libselinux-devel aarch64 2.5-15.el7 base 186 k
libsepol-devel aarch64 2.5-10.el7 base 76 k
libverto-devel aarch64 0.2.5-4.el7 base 11 k
pcre-devel aarch64 8.32-17.el7 base 479 k
perl-WWW-Curl aarch64 4.15-13.el7 base 52 k
zlib-devel aarch64 1.2.7-18.el7 base 49 k
mysql source 5.7.29 https://mirrors.huaweicloud.com/mysql/Downloads/MySQL-5.7/mysql-5.7.29.tar.gz
mysql-boost source 5.7.29 https://mirrors.huaweicloud.com/mysql/Downloads/MySQL-5.7/mysql-boost-5.7.29.tar.gz
1.创建应用安装目录;
mkdir -p /data/dbdat/mysql/data/ mkdir -p /data/conf/mysql/ mkdir -p /data/logs/mysql/tmp mkdir -p /data/dbdat/mysql/backup/ touch /data/logs/mysql/error.log mkdir -p /data/svr/mysql mkdir -p /data/svr/mysql/tmp
2.升级系统gcc版本
yum install centos-release-scl yum install devtoolset-7 scl enable devtoolset-7 bash ln -s /opt/rh/devtoolset-7/root/usr/bin/c++ /usr/bin/c++
3.我们先升级服务器依赖后安装一些编译依赖
yum update -y && yum install -y ncurses-devel openssl* wget
4.进入/data/svr/目录 下载mysql的编译包及其依赖
cd /data/svr
5.下载mysql源码并进行解压
wget http://mirrors.myhuawei.cn/mysql/mysql-5.7.29.tar.gz && tar zxvf mysql-5.7.29.tar.gz
6.下载boost支持库并进行解压
wget https://mirrors.huaweicloud.com/mysql/Downloads/MySQL-5.7/mysql-boost-5.7.29.tar.gz && tar zxvf mysql-boost-5.7.29.tar.gz
7.进入mysql源码目录
cd /data/svr/mysql-5.7.29
8. 使用cmake进行编译参数设置
cmake . -DCMAKE_INSTALL_PREFIX=/data/svr/mysql \ -DMYSQL_DATADIR=/data/dbdat/mysql/data/ \ -DSYSCONFDIR=/etc \ -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -DWITH_ARCHIVE_STORAGE_ENGINE=1 \ -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \ -DWITH_READLINE=1 \ -DWITH_LIBWRAP=0 \ -DMYSQL_UNIX_ADDR=/data/svr/mysql/tmp/mysql.sock \ -DWITH_SSL=system \ -DWITH_ZLIB=system \ -DWITH_BOOST=./boost/boost_1_59_0 \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci
9.执行编译指令 ,根据cpu来选择对应编译线程
make && make install
10.添加一个mysql用户并设置相关目录的权限
useradd -M -s /sbin/nologin mysql chown -R mysql.mysql /data/svr/mysql chown -R mysql.mysql /data/dbdat/mysql chown -R mysql.mysql /data/logs/mysql
11.拷贝mysql文件到/usr/bin
cp /data/svr/mysql/bin/* /usr/bin/
12.初始化mysql
wget http://mirrors.myhuawei.cn/mysql/my.cnf -O /etc/my.cnf /data/svr/mysql/bin/mysqld --initialize --user=mysql --basedir=/data/svr/mysql/ --datadir=/data/dbdat/mysql/data
13.到日志目录获取默认密码
less /data/logs/mysql/error.log | grep password | awk {'print $11'}
14.启动mysql服务器
/data/svr/mysql/bin/mysqld --user=mysql --basedir=/data/svr/mysql/ --datadir=/data/dbdat/mysql/data &
15.修改mysql默认密码
mysql -uroot -p
输入上一步获取的密码
set password for 'root'@'localhost'=password('这里替换成密码'); flush privileges
例如:
set password for 'root'@'localhost'=password('huaweicloud');
- 点赞
- 收藏
- 关注作者
评论(0)