如何通过源码包方式安装Perconaserver-创新互联
这篇文章将为大家详细讲解有关如何通过源码包方式安装Percona server,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。
创新互联建站服务紧随时代发展步伐,进行技术革新和技术进步,经过10年的发展和积累,已经汇集了一批资深网站策划师、设计师、专业的网站实施团队以及高素质售后服务人员,并且完全形成了一套成熟的业务流程,能够完全依照客户要求对网站进行网站制作、做网站、建设、维护、更新和改版,实现客户网站对外宣传展示的首要目的,并为客户企业品牌互联网化提供全面的解决方案。Installing Percona Server from a Source Tarball
1 下载源码tar包
/tupian/20230522/percona-server lang="EN-US">2 安装Cmake
下载cmake:https://cmake.org/download/
]# tar -zxvf cmake-2.8.9.tar.gz
]# cd cmake-2.8.9
#查看帮助
]# cat Readme.txt
$ ./bootstrap; make; make install
]# ./bootstrap
]# make
]# make install
3 创建相关目录
#basedir
~]# mkdir -p /app/mysql
#datadir
~]# mkdir -p /data/percona/mysql/data
~]# chown mysql:mysql /app/mysql/ -R
~]# chown mysql:mysql /data/percona/mysql/ -R
4 解压
]# tar -zxvf percona-server-5.6.29-76.2.tar.gz
]# cd percona-server-5.6.29-76.2
5 编译安装
1 使用cmake配置bulid
]#cmake . -LH
]#cmake . \
-DCMAKE_INSTALL_PREFIX=/app/mysql \ #设置程序安装路径
-DMYSQL_DATADIR=/data/percona/mysql/data \ #设置数据存放路径
-DSYSCONFDIR=/app/mysql \ #配置文件路径,由于当前有别的mysql实例运行,没有指定/etc
-DWITH_MYISAM_STORAGE_ENGINE=1 \ #启用MYISAM存储引擎
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DWITH_FEDERATED_STORAGE_ENGINE=1 \
-DMYSQL_UNIX_ADDR=/data/percona/mysql/mysqld.sock \ #设置套接字存放位置
-DMYSQL_TCP_PORT=6603 \ #设置开放端口
-DENABLED_LOCAL_INFILE=1 \ #设置读取本地文件
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 \ #默认字符串
-DDEFAULT_COLLATION=utf8_general_ci #默认检验规则
附,如果cmake错误,需要重新cmake,需要清除之前的cmake信息:
]# make clean
]# rm –f CMakeCache.txt
2 使用make编译
#-j后面是逻辑CPU的个数,可以根据实际情况来指定
]#make -j `grep processor /proc/cpuinfo | wc -l`
3 使用make install安装
]#make install
6 创建配置文件
]# cat /app/mysql/my.cnf
[mysqld]
basedir=/app/mysql
datadir=/data/percona/mysql/data
socket=/data/percona/mysql/mysql.sock
log-error=/data/percona/mysql/mysqld.log
innodb_buffer_pool_size = 128M
port=6603
7 初始化db
]# ./scripts/mysql_install_db --defaults-file=/app/mysql/my.cnf
8 启动percona mysql
#注意,如果使用的root账户初始化db,生成的文件都是root拥有,而mysqld是以mysql用户运行的,对默认生成的文件没权限,可能无法正常start,如报错:
26803 [Note] Plugin 'FEDERATED' is disabled.
/app/mysql/bin/mysqld: Can't find file: './mysql/plugin.frm' (errno: 13 - Permission denied)
2016-05-04 14:40:21 26803 [ERROR] InnoDB: ./ibdata1 can't be opened in read-write mode
2016-05-04 14:40:21 26803 [ERROR] InnoDB: The system tablespace must be writable!
2016-05-04 14:40:21 26803 [ERROR] Plugin 'InnoDB' init function returned error.
2016-05-04 14:40:21 26803 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2016-05-04 14:40:21 26803 [ERROR] Unknown/unsupported storage engine: InnoDB
2016-05-04 14:40:21 26803 [ERROR] Aborting
#此时,修改basedir和datadir下的文件的所有者和所属组为mysql
]# chown mysql:mysql /data/percona/mysql/ -R
]# chown mysql:mysql /app/mysql/ -R
#再启动mysql
]# /data/percona/mysql/bin/mysqld_safe --defaults-file=/tmp/my.cnf &
160504 10:37:02 mysqld_safe Adding '/data/percona/mysql/lib/mysql/libjemalloc.so.1' to LD_PRELOAD for mysqld
160504 10:37:02 mysqld_safe Logging to '/data/percona/mysql/mysqld.log'.
160504 10:37:02 mysqld_safe Starting mysqld daemon with databases from /data/percona/mysql/data
9 查看进程
]# netstat -antpl|grep mysqld
tcp 0 0 :::6603 :::* LISTEN 27166/mysqld #percona mysql
tcp 0 0 :::3306 :::* LISTEN 23233/mysqld #默认运行的mysql
10 查看log
]# tail -f /data/percona/mysql/mysqld.log
2016-05-04 14:42:02 27166 [Note] InnoDB: Waiting for purge to start
2016-05-04 14:42:02 27166 [Note] InnoDB: Percona XtraDB (http://www.percona.com) 5.6.29-76.2 started; log sequence number 1626426
2016-05-04 14:42:02 27166 [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: 4eeaade7-11c3-11e6-86b0-782bcb6aa29a.
2016-05-04 14:42:02 27166 [Note] Server hostname (bind-address): '*'; port: 6603
2016-05-04 14:42:02 27166 [Note] IPv6 is available.
2016-05-04 14:42:02 27166 [Note] - '::' resolves to '::';
2016-05-04 14:42:02 27166 [Note] Server socket created on IP: '::'.
2016-05-04 14:42:02 27166 [Note] Event Scheduler: Loaded 0 events
2016-05-04 14:42:02 27166 [Note] /app/mysql/bin/mysqld: ready for connections.
Version: '5.6.29-76.2' socket: '/data/percona/mysql/mysql.sock' port: 6603 Source distribution
11 卸载percona server
a.Stop percona mysql server
b.rm –rf basedir && rm –rf datadir
关于“如何通过源码包方式安装Percona server”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,使各位可以学到更多知识,如果觉得文章不错,请把它分享出去让更多的人看到。
分享题目:如何通过源码包方式安装Perconaserver-创新互联
分享地址:http://scjbc.cn/article/iphge.html