centos6.5_64bit下编译安装mysql-5.6.23
centos6.5_64bit下编译安装mysql-5.6.23
一、关闭防火墙
chkconfig iptables off
service iptables stop
二、下载mysql源码包,mysql-5.6.23.tar.gz
下载时注意别选成其他的linux安装包,,不然编译肯定报错。选择平台的下拉列表里选择 source code,select platform: source code ,
下载 generic linux (architecture independent), compressed tar archive。
三、添加用户和组:
groupadd mysql #增加用户组
useradd -g mysql mysql -s /usr/sbin/nologin
四、创建目录及授权
mkdir -p /u01/my3306/data #mysql数据目录
mkdir -p /u01/my3306/log/iblog #mysql innodb日志
mkdir -p /u01/my3306/log/binlog #mysql日志
mkdir -p /u01/my3306/log/relaylog
mkdir -p /u01/my3306/run
mkdir -p /u01/my3306/tmp
chown -r mysql:mysql /u01/my3306
chmod -r 755 /u01/my3306
五、解压
tar -zxvf mysql-5.6.23.tar.gz
cd mysql-5.6.23
六、编译并安装
cmake \
-dcmake_install_prefix=/u01/my3306 \
-dinstall_datadir=/u01/my3306/data \
-ddefault_charset=utf8 \
-ddefault_collation=utf8_general_ci \
-dextra_charsets=all \
-dwith_ssl=yes \
-dwith_embedded_server=1 \
-denabled_local_infile=1 \
-dwith_myisam_storage_engine=1 \
-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_tcp_port=3306 \
-denabled_local_infile=1 \
-dsysconfdir=/etc \
-dwith_readline=on
make
make install
七、修改配置文件my.cnf参数
cp /u01/my3306/support-files/my-default.cnf /u01/my3306/my.cnf
vi /u01/my3306/my.cnf ---添加
[client]
port = 3306
socket =/u01/my3306/run/mysql.sock
[mysql]
no-auto-rehash
pid_file=/u01/my3306/run/mysqld.pid
[mysqld]
## disable autocommit
autocommit=0
general_log=off
explicit_defaults_for_timestamp=true
# system
basedir=/u01/my3306
datadir=/u01/my3306/data/
max_allowed_packet=134217728
max_connections=8192
max_user_connections=8000
open_files_limit=65535
pid_file=/u01/my3306/run/mysqld.pid
port=3306
server_id=1
skip_name_resolve=on
socket=/u01/my3306/run/mysql.sock
tmpdir=/u01/my3306/tmp
# binlog
binlog_cache_size=32768
binlog_format=row
expire_logs_days=7
log_bin=/u01/my3306/log/binlog
log_slave_updates=on
max_binlog_cache_size=2147483648
max_binlog_size=524288000
sync_binlog=100
#relay
relay_log=/u01/my3306/log/relaylog
relay_log_index=/u01/my3306/log/relay.index
relay_log_info_file=/u01/my3306/log/relay-log.info
# logging #
log_error = /u01/my3306/log/alert.log
log_queries_not_using_indexes = 1
slow_query_log = 1
slow_query_log_file = /u01/my3306/log/slow.log
log_slave_updates=on
log_slow_admin_statements=1
long_query_time=1
#slave#
slave_skip_errors=off
log_slave_updates=on
# innodb #
innodb_log_group_home_dir=/u01/my3306/log/iblog
innodb_data_home_dir=/u01/my3306/log/iblog
innodb_adaptive_flushing=1
innodb_additional_mem_pool_size=20m
innodb_buffer_pool_instances=8
innodb_change_buffering=inserts
innodb_data_file_path=ibdata1:32m;ibdata2:16m:autoextend
innodb_flush_method = o_direct
innodb_log_files_in_group = 4
innodb_log_file_size = 32m
innodb_flush_log_at_trx_commit = 1
innodb_file_per_table = 1
innodb_buffer_pool_size = 128m
innodb_file_format=barracuda
innodb_file_io_threads=4
innodb_flush_neighbors=0
innodb_io_capacity=200
innodb_lock_wait_timeout=5
innodb_log_buffer_size=64m
innodb_lru_scan_depth=2048
innodb_max_dirty_pages_pct=60
innodb_old_blocks_time=1000
innodb_online_alter_log_max_size=200m
innodb_open_files=200
innodb_print_all_deadlocks=1
innodb_purge_threads=4
innodb_read_ahead_threshold=0
innodb_read_io_threads=8
innodb_rollback_on_timeout=0
innodb_sort_buffer_size=2m
innodb_spin_wait_delay=6
innodb_stats_on_metadata=0
innodb_strict_mode=1
innodb_sync_array_size=256
innodb_sync_spin_loops=30
innodb_thread_concurrency=64
innodb_use_native_aio=0
innodb_write_io_threads=8
innodb_support_xa=1
[mysqld_safe]
datadir=/u01/my3306/data/
八、执行mysql安装脚本
./scripts/mysql_install_db --defaults-file=/u01/my3306/my.cnf --user=mysql --datadir=/u01/my3306/data
说明:defaults-file表示指定默认的配置文件,如果不指定,系统默认的优先级是先使用/etc/my.cnf作为mysql的配置文件,那之前make的那些参数就白设置了.
九、启动mysql
mysqld_safe --defaults-file=/u01/app/mysql/data/mysql3306/my.cnf --user=mysql &
十、登录mysql
mysql -h127.0.0.1 -uroot -p3306
--------------------------------------分割线 --------------------------------------
ubuntu 14.04下安装mysql
《mysql权威指南(原书第2版)》清晰中文扫描版 pdf
ubuntu 14.04 lts 安装 lnmp nginx\php5 (php-fpm)\mysql
ubuntu 14.04下搭建mysql主从服务器
ubuntu 12.04 lts 构建高可用分布式 mysql 集群
ubuntu 12.04下源代码安装mysql5.6以及python-mysqldb
mysql-5.5.38通用二进制安装
--------------------------------------分割线 --------------------------------------
本文永久更新链接地址: