centos7.3上编译安装percona5.7.18

一,删除操作系统自带mariadb

yum remove mariadb

二,下载需要的安装包

percona-toolkit-3.0.3-1.el7.x86_64.rpm

boost_1_59_0.tar.gz

percona-xtrabackup-24-2.4.7-1.el6.x86_64.rpm

libev4-4.15-7.1.x86_64.rpm

percona-server-5.7.18-14.tar.gz

三,在存放安装包的目录执行(通过yum的方式把其他的依赖包也安装了)

yum -y install gcc gcc-c++  make cmake automake  autoconf libxml2 libxml2-devel zlib zlib-devel ncurses ncurses-devel readline-devel

yum -y install  libev4-4.15-7.1.x86_64.rpm

yum -y install percona-toolkit-3.0.3-1.el7.x86_64.rpm

yum -y install percona-xtrabackup-24-2.4.7-1.el6.x86_64.rpm

四,建个存放boost的路径

cp -rp boost_1_59_0.tar.gz /usr/local/boost/

五,解压percona server软件

tar -zxvf percona-server-5.7.18-14.tar.gz

cd percona-server-5.7.18-14

六,创建用户和目录

mkdir -p /data/mysql/{run,mysql,data,tmp}

groupadd mysql

useradd -g mysql mysql

chown -R mysql:mysql /data/

七,编译安装

cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/mysql/data -DDEFAULT_CHARSET=utf8mb4 -DDEFAULT_COLLATION=utf8mb4_general_ci -DMYSQL_TCP_PORT=3306 -DMYSQL_USER=mysql -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1  -DDOWNLOAD_BOOST=1 -DWITH_READLINE=ON -DWITH_BOOST=/usr/local

make-j `grep processor/proc/cpuinfo|wc-l`

make install

八,初始化数据库
/usr/local/mysql/bin/mysqld --defaults-file=/usr/local/mysql/my.cnf --initialize --user=mysql

九、将mysql加入服务

cp -a /usr/local/mysql/support-files/mysql.server  /etc/init.d/mysql
chmod +x /etc/init.d/mysql
chkconfig mysql on

cp -rp /usr/local/mysql/bin/* /usr/bin/

十、启动mysql

service mysql start

十一、修改密码

可以到error.log里面查找初始密码登录。

cat /data/mysql/logs/error.log |grep pass
mysql –uroot –pxxxxx –h127.0.0.1

mysql> SET PASSWORD = PASSWORD('xxxxxxx');

mysql> flush privileges;
mysql> quit;

 

 

遇到的问题

带上-DWITH_READLINE=ON 时编译报错,怀疑是操作系统上readline包版本和数据库要求的不匹配,由于这个功能不太影响数据库使用所以编译的时候就没带上这个参数了。

CMake Error at cmake/readline.cmake:286 (MESSAGE):
  WITH_EDITLINE must be bundled or system
Call Stack (most recent call first):
  CMakeLists.txt:493 (MYSQL_CHECK_EDITLINE)


-- Configuring incomplete, errors occurred!
See also "/usr/local/software/percona-server-5.7.18-14/CMakeFiles/CMakeOutput.log".
See also "/usr/local/software/percona-server-5.7.18-14/CMakeFiles/CMakeError.log".

posted @ 2017-06-05 11:41  haoshuaili  阅读(768)  评论(0编辑  收藏  举报