您的位置:首页 > 运维架构 > Linux

Percona MySQL编译安装到CentOS6.5

2015-10-10 16:02 621 查看
下载 percona-server-5.6.26-74.0.tar.gz
利用yum安装一些必须的软件:
yum -y install make gcc gcc-c++ cmake bison-devel ncurses-devel gcc \
autoconf* automake* zlib* fiex* libxml* libmcrypt* libtool-ltdl-devel* \
openssl openssl-devel ncurses compat* mpfr cpp glibc readline-devel

解压缩percona server,然后输入:
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql/ \
-DSYSCONFDIR=/etc \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_FEDERATED_STORAGE_ENGINE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DMYSQL_UNIX_ADDR=/var/run/mysql.sock \
-DMYSQL_TCP_PORT=3306 \
-DENABLED_LOCAL_INFILE=1 \
-DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DMYSQL_USER=mysql

make

make install
当make成功后就在/usr/local/mysql建立mysql服务
cd /usr/local/mysql/
cp support-files/mysql.server /etc/init.d/mysql

mkdir -p /Data/mysql/data

chown -R mysql. /Data

ln -s /usr/local/mysql/lib /usr/lib/mysql

ln -s/usr/local/mysql/include/mysql /usr/include/mysqlln -s /usr/local/mysql/lib/libperconaserverclient.so.18 /usr/lib64/libmysqlclient.so.18

创建my.cnf文件:
[mysqld]
#sql_mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
pid-file=/Data/mysql/mysqld.pid
datadir = /Data/mysql/data
socket=/Data/mysql/mysql.sock
user=mysql
character-set-server = utf8
port = 3306
# Disabling symbolic-links is recommended to prevent assorted security risks
#symbolic-links=0
default-storage-engine=InnoDB
explicit_defaults_for_timestamp=true
max_connections = 300
#sort_buffer_size = 16M
#join_buffer_size = 16M
#read_buffer_size = 24M
#read_rnd_buffer_size = 24M
#bulk_insert_buffer_size=64M
#InnoDB
#
#if the below parameter added later, mysql cannot startup.
innodb_data_home_dir=/Data/mysql/inndb_data
innodb_data_file_path=ibdata1:2048M:autoextend
innodb_file_per_table=1
innodb_file_format=barracuda
innodb_buffer_pool_size = 1G
innodb_buffer_pool_instances=3
innodb_purge_threads=1
innodb_support_xa=FALSE
innodb_flush_method = O_DIRECT
innodb_io_capacity=200
skip_innodb_adaptive_hash_index
innodb_read_io_threads=8
innodb_write_io_threads=8
innodb_change_buffering=all
innodb_stats_on_metadata=off
innodb_log_group_home_dir=/Data/mysql/innodb_log
innodb_log_buffer_size = 16M
innodb_log_file_size = 256M
innodb_log_files_in_group = 3
innodb_flush_log_at_trx_commit=2
innodb_autoinc_lock_mode=2
innodb_additional_mem_pool_size = 32M
innodb_thread_concurrency=8
skip_grant_tables
max_tmp_tables=100
query_cache_size=0
query_cache_type=0
max_prepared_stmt_count=1048576
sort_buffer_size=32769
#BINLOG
#binlog-do-db=sumarc
#binlog-do-db=middleware
log-bin=/Data/mysql/binlog/bin-file.log
binlog_cache_size = 1M
binlog_format=MIXED
max_binlog_size=256M
max_binlog_cache_size=50M
expire_logs_days = 91
sync_binlog=2
#slow_query_log=on
#long_query_time=1
#slow_query_log_file=/Data/mysql/slowlog/mysql-slow
log-error=/Data/mysql/mysqld_error.log
#slave-skip-errors=1032,1062,126,1114,1146,1048,1396
#skip-host-cache
#skip-name-resolve
#rpl_semi_sync_master_enabled=1
#rpl_semi_sync_master_timeout=1000
#rpl_semi_sync_master_trace_level=32
#rpl_semi_sync_master_wait_no_slave=on
[mysqld_safe]
pid-file=/Data/mysql/mysqld.pid
#socket=/var/run/mysql.sock
[client]
socket=/Data/mysql/mysql.sock
填充数据:
scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/Data/mysql/data/ --user=mysql

启动mysql:
/etc/init.d/mysql start
启动成功

本文出自 “技术博客” 博客,请务必保留此出处http://raytech.blog.51cto.com/7602157/1701580
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: