percona Server for MySQL 5.7源码安装

举报
snowofsummer 发表于 2021/02/05 13:32:14 2021/02/05
【摘要】 1,软件下载#Source Code(percona-server-5.7.27-30.tar.gz)https://www.percona.com/downloads/Percona-Server-5.7#Boost-1.59.0http://www.linuxfromscratch.org/blfs/view/7.8/general/boost.html2,环境准备CentOS Linu...

1,软件下载

#Source Code(percona-server-5.7.27-30.tar.gz)
https://www.percona.com/downloads/Percona-Server-5.7
#Boost-1.59.0
http://www.linuxfromscratch.org/blfs/view/7.8/general/boost.html

2,环境准备

CentOS Linux release 7.8.2003 (Core)

yum -y install readline-devel gcc gcc-c++ boost make cmake bison bison-devel ncurses-devel libaio-devel perl git libtirpc libtirpc-devel curl-devel
l

#根据需求修改安装目录位置
useradd -s /sbin/nologin -M mysql
mkdir -p /opt/mysql
mkdir -p /data/mysql/data
mkdir -p /opt/mysql/etc
chown -R mysql:mysql /data/mysql

3,软件安装

#注意DWITH_BOOST文件位置。

cmake . \
-DCMAKE_INSTALL_PREFIX=/opt/mysql \
-DMYSQL_DATADIR=/data/mysql/data \
-DSYSCONFDIR=/opt/mysql/etc \
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \
-DWITH_BOOST=/root/boost_1_59_0 \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_EDITLINE=0 \
-DENABLED_LOCAL_INFILE=1 \
-DENABLE_DOWNLOADS=1

#根据cpu个数指定并行参数。
make -j 4
make install

4,数据库初始化

建立目录,参数文件

mkdir /3306
mkdir /3306/data
mkdir /3306/log
mkdir /3306/run
touch /3306/log/db.log
chown -R mysql:mysql /3306

cat >> /3306/my.cnf<<EOF
[mysqld]
port=3306
datadir=/3306/data
socket=/3306/mysql.sock
[mysqld_safe]
log-error=/3306/log/db.log
pid-file=/3306/run/db.pid
EOF

初始化数据文件(root无密码)

[root@db01 mysql]# /opt/mysql/bin/mysqld --defaults-file=/3306/my.cnf  --user=mysql --initialize-insecure
2021-02-05T05:12:44.132548Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2021-02-05T05:12:44.321714Z 0 [Warning] InnoDB: New log files created, LSN=45790
2021-02-05T05:12:44.353505Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2021-02-05T05:12:44.409677Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: c7633062-6770-11eb-8f74-000c29a91aed.
2021-02-05T05:12:44.410221Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2021-02-05T05:12:44.410761Z 1 [Warning] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure opti

启动数据库

[root@db01 mysql]# /opt/mysql/bin/mysqld_safe --defaults-file=/3306/my.cnf
2021-02-05T05:13:36.786141Z mysqld_safe Logging to '/3306/log/db.log'.
2021-02-05T05:13:36.874158Z mysqld_safe Starting mysqld daemon with databases from /3306/data

连接测试数据库

[root@db01 bin]# mysql -uroot  -S /3306/mysql.sock -e "show databases;"
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+

【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。