《MYSQL教程CentOS 6.5编译安装Percona 5.6.15(步骤)》要点:
本文介绍了MYSQL教程CentOS 6.5编译安装Percona 5.6.15(步骤),希望对您有用。如果有疑问,可以联系我们。
导读:CentOS 6.5下通过yum安装的MySQL是5.1版的,于是想通过源代码安装高版本的5.6.15.版本为 Percona 5.6.15源码版,下载地址:http://www....
MYSQL数据库CentOS 6.5下通过yum安装的MySQL是5.1版的,于是想通过源代码安装高版本的5.6.15.
MYSQL数据库版本为 Percona 5.6.15源码版,下载地址:
http://www.percona.com/redir/downloads/Percona-Server-5.6/LATEST/source/Percona-Server-5.6.15-rel63.0.tar.gz
MYSQL数据库一、卸载原有MySQL
检查是否安装有MySQL Server:
rpm -qa | grep mysql
MYSQL数据库删除办法:
rpm -e mysql #普通删除模式
rpm -e --nodeps mysql #强行删除模式,如果使用上面命令删除时,提示有依赖的其它文件,则用该命令可以对其强行删除.
MYSQL数据库二、安装gcc编译环境
yum -y install make gcc-c++ cmake bison-devel ncurses-devel
MYSQL数据库三、安装CMake
下载地址:
http://www.cmake.org/files/v2.8/cmake-2.8.12.1.tar.gz
MYSQL数据库切换到root用户,使用命令安装:
./bootstrap
#检查无误后安装
make && make install
MYSQL数据库四、安装MySQL
1,设置权限
groupadd dba
useradd mysql -g dba
MYSQL数据库2,设置安装环境
#为保证数据平安,将数据单独存盘于/data目录下
mkdir /app/mysql
mkdir /data/mysql
cd /data/mysql
mkdir run data tmp logs
chown -R mysql:dba /app/mysql
chown -R mysql:dba /data/mysql
MYSQL数据库3,安装mysql(Percona 5.6.15)
tar zxvf Percona-Server-5.6.15-rel63.0.tar.gz
cd Percona-Server-5.6.15
cmake . -LH
cmake .
-DCMAKE_INSTALL_PREFIX=/app/mysql #设置程序安装路径
-DMYSQL_DATADIR=/data/mysql/data #设置数据存放路径
-DSYSCONFDIR=/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
-DWITH_READLINE=1 #启用MySQL快捷键
-DMYSQL_UNIX_ADDR=/data/mysql/run/mysqld.sock #设置套接字存放位置
-DMYSQL_TCP_PORT=3306 #设置开放端口
-DENABLED_LOCAL_INFILE=1 #设置读取当地文件
-DWITH_PARTITION_STORAGE_ENGINE=1
-DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 #默认字符串
-DDEFAULT_COLLATION=utf8_general_ci #默认检验规则
#以上代码为方便查看,若直接执行,可使用下面代码
cmake . -DCMAKE_INSTALL_PREFIX=/app/mysql -DMYSQL_DATADIR=/data/mysql/data -DSYSCONFDIR=/etc -DWITH_MYISAM_STORAGE_ENGINE=1 -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 -DWITH_READLINE=1 -DMYSQL_UNIX_ADDR=/data/mysql/run/mysqld.sock -DMYSQL_TCP_PORT=3306 -DENABLED_LOCAL_INFILE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci
make -j 4 && make install
MYSQL数据库4,安装完成Percona 5.6.15后,开始建立配置文件.
chown mysql:dba /etc/my.cnf
vim /etc/my.cnf
[client]
#password = your_password
port = 3306
socket = /data/mysql/run/mysql.sock
default-character-set=utf8
[mysqld]
port = 3306
socket = /data/mysql/run/mysql.sock
baserdir = /app/mysql
datadir = /data/mysql/data
skip-external-locking
key_buffer_size = 16M
max_allowed_packet = 1M
table_open_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
default-storage-engine = InnoDB
character_set_server = utf8
tmpdir = /data/mysql/tmp/
log-bin=/data/mysql/logs/mysql-bin
expire_logs_days= 14
binlog_format=mixed
log-error = /data/mysql/logs/error.log
slow-query-log = 1
long_query_time= 3
slow_query_log_file = /data/mysql/logs/slow.log
server-id = 1
innodb_data_home_dir = /data/mysql/data
innodb_data_file_path = ibdata1:10M:autoextend
innodb_log_group_home_dir = /data/mysql/logs
innodb_buffer_pool_size = 16M
innodb_additional_mem_pool_size = 2M
innodb_log_file_size = 5M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50
innodb_file_per_table = 1
[mysqldump]
quick
max_allowed_packet = 16M
[mysql]
no-auto-rehash
[myisamchk]
key_buffer_size = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interactive-timeout
MYSQL数据库5,初始MySQL配置表(用户权限表等)
./scripts/mysql_install_db --basedir=/app/mysql --datadir=/data/mysql/data --user=mysql --force
MYSQL数据库6,设置开机启动
su -
cp /app/mysql/support-files/mysql.server /etc/init.d/mysql
chmod +x /etc/init.d/mysql
chkconfig -add mysql
chkconfig --level 345 mysql on
MYSQL数据库7,修改Path变量
vim /etc/profile
在句末参加
PATH=/app/mysql/bin:$PATH
export PATH
MYSQL数据库启用PATH
. /etc/profile
#or
source /etc/profile
MYSQL数据库8,启动MySQL,并设置暗码
service mysql start
mysqladmin -uroot password '******'
MYSQL数据库至此,胜利安装Percona 5.6.15.
欢迎参与《MYSQL教程CentOS 6.5编译安装Percona 5.6.15(步骤)》讨论,分享您的想法,维易PHP学院为您提供专业教程。
转载请注明本页网址:
http://www.vephp.com/jiaocheng/12740.html