CentOS 6.5 安装 Percona-Server-5.5.33

环境版本信息:
OS:CentOS 6.5 X86_64
MySQL:Percona-Server-5.5.33
Iptables and SElinux is disabled

准备工作:
安装依赖包
yum install -y libaio openssl openssl098e

缺少依赖包会出现报如下错误:
error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
error while loading shared libraries: libssl.so.6: cannot open shared object file: No such file or directory


获取安装包:
wget https://www.percona.com/downloads/Percona-Server-5.5/Percona-Server-5.5.33-31.1/binary/linux/x86_64/Percona-Server-5.5.33-rel31.1-566.Linux.x86_64.tar.gz

安装步骤:
1.创建msyql用户组和用户。
groupadd mysql
useradd -r -g mysql mysql

2.解压二进制压缩包到目标目录
tar -zxvf Percona-Server-5.5.33-rel31.1-566.Linux.x86_64.tar.gz -C /usr/local/

3.建立一个软链接。
ln -s Percona-Server-5.5.33-rel31.1-566.Linux.x86_64/ /usr/local/mysql

使用软件连的方式是为了方便管理。

4.修改目录权限
chown -R mysql:mysql Percona-Server-5.5.33-rel31.1-566.Linux.x86_64/

5.准备配置文件
该配置文件是一个简单样本,MySQL每个版本支持和需要关注参数也有差别。
这里给大家推荐一个配置文件在线生成页面,目前支持 5.7 和 8.0版本:
http://imysql.com/my-cnf-wizard.html

vi /etc/my.cnf
[mysql]
socket=/tmp/mysql.sock
port=3306

[mysqld]
user=mysql
basedir=/usr/local/mysql/
datadir=/usr/local/mysql/data
socket=/tmp/mysql.sock
port=3306
symbolic-links=0
max_allowed_packet = 32M

character-set-server = utf8
skip_name_resolve = 1
open_files_limit = 65535
back_log = 1024
max_connections = 1024
max_connect_errors = 1000000
interactive_timeout = 600
wait_timeout = 600
query_cache_size = 0
query_cache_type = 0

slow_query_log = 1
slow_query_log_file = /usr/local/mysql/data/slow.log
long_query_time = 2

innodb_buffer_pool_size = 4G
innodb_data_file_path = ibdata1:1G:autoextend
innodb_file_per_table=1
innodb_flush_log_at_trx_commit = 1
innodb_thread_concurrency = 0


[mysqld_safe]
log-error = /usr/local/mysql/data/error.log
pid-file=/usr/local/mysql/data/mysql.pid

[client]
port=3306

[mysqldump]
quick
max_allowed_packet = 32M


6.安装初始化
./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data

 

7.添加开机服务
cd /usr/local/mysql
cp support-files/mysql.server /etc/init.d/mysqld
chmod -x /etc/init.d/mysqld
chkconfig --add mysqld
chkconfig mysqld off

生产环境不建议开启开机自启动,防止带病生产。

8.设置环境变量
echo "PATH=$PATH:/usr/local/mysql/bin;export PATH" >> /etc/profile
source /etc/profile

9.启动mysql
service mysqld start
或者
mysqld_safe --defaults-file=/etc/my.cnf &

10.设置密码
mysqladmin -u root password AY1ZtdhJHb8a

11.二进制安装的MySQL,对于其他软件在编译过程中需要调用MySQL lib的情况:
采取简单粗暴的办法,直接创建软连接
ln -s /usr/local/mysql/lib/* /usr/lib/

软件运行时加载库路径
如果安装了MySQL-libs,可以将路径/usr/local/mysql/lib添加到MySQL-libs配置文件中
echo "/usr/local/mysql/lib" >> /etc/ld.so.conf.d/mysql-x86_64.conf
或者
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH: /usr/local/mysql/lib/

 

转载于:https://www.cnblogs.com/lidx/p/9722424.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值