泰山服务器openEuler安装mysql 8的yum源,如果安装5.7.x,必须手工编译
1 添加mysql用户
groupadd mysql
useradd -r -g mysql mysql
2 配置openEuler源
-
wget -O /etc/yum.repos.d/openEulerOS.repo httpsmirrors.huaweicloud.com/repository/conf/openeuler_aarch64.repo
清除原有yum缓存
yum clean all
生成新的缓存
yum makecache
3 安装cmake
下载 cmake-3.21.4-linux-aarch64.sh
运行 ./cmake-3.21.4-linux-aarch64.sh,安装在根目录下
4 安装依赖
yum -y install ncurses ncurses-devel libaio-devel gmp gmp-devel mpfr mpfr-devel libmpcdec zlib-devel net-tools cmake openssl openssl-devel gcc-c++ rpcgen
5 添加环境
export PATH=/cmake-3.21.4-linux-aarch64/bin:$PATH
6 下载mysql源码
-
https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-boost-5.7.35.tar.gz
tar zxvf mysql-boost-5.7.35.tar.gz
cd mysql-5.7.35
修改 CMakeLists.txt 删除 INCLUDE(cmake/abi_check.cmake),
否则出现
[root@429335d3166c mysql-5.7.27]# make
CMake Error at cmake/do_abi_check.cmake:79 (MESSAGE):
ABI check found difference between
/mysql-5.7.27/include/mysql/plugin_audit.h.pp and
/mysql-5.7.27/abi_check.out
配置编译环境
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_DATADIR=/data \
-DSYSCONFDIR=/etc \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DWITH_FEDERATED_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DENABLE_DTRACE=0 \
-DDEFAULT_CHARSET=utf8mb4 \
-DDEFAULT_COLLATION=utf8mb4_general_ci \
-DWITH_EMBEDDED_SERVER=1 \
-DDOWNLOAD_BOOST=1 \
-DWITH_BOOST=./boost/boost_1_59_0
编译安装
make -j96
make install
#配置环境变量
export PATH=/usr/local/mysql/bin:$PATH
7 配置MySQL
新建配置文件
vi /etc/my.cnf
#写入以下内容
[mysqld]
datadir=/data
socket=/var/lib/mysql/mysql.sock
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
#修改权限
chmod 644 /etc/my.cnf
创建相关文件及修改权限
mkdir /var/lib/mysql
mkdir /var/run/mysqld
touch /var/log/mysqld.log
touch /var/lib/mysql/mysql.sock
touch /var/run/mysqld/mysqld.pid
chown mysql:mysql /var/log/mysqld.log
chown -R mysql:mysql /var/lib/mysql
chown -R mysql:mysql /var/run/mysqld
初始化数据库
mysqld --initialize --user=mysql
生成的文件将在/data下:
8 加入服务
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
#启动服务
service mysqld start
登录
初始密码在/var/log/mysqld.log里边可以查找到
mysql -uroot -h127.0.0.1 -p
ALTER USER USER() IDENTIFIED BY 'root2019';
修改密码
阅读(2857) | 评论(0) | 转发(0) |