centos6.7 安装 mysql5.6
2016-03-24 18:24
495 查看
系统环境,请查看《virtualbox5.0.8 centos6.7 mini 安装》
准备源码包mysql-5.6.19.tar.gz ,上传至/opt 目录
groupadd mysql
useradd -g mysql mysql -s /bin/false
mkdir -p /data/mysql
chown -R mysql:mysql /data/mysql
mkdir -p /usr/local/mysql
yum -y install autoconf
cd mysql-5.6.19
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/mysql -DSYSCONFDIR=/etc
make && make install
cd /usr/local/mysql
./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql
rm -f /etc/my.cnf
ln -s /usr/local/mysql/my.cnf /etc/my.cnf
cp ./support-files/mysql.server /etc/rc.d/init.d/mysqld
chmod 755 /etc/init.d/mysqld
chkconfig mysqld on
vi /etc/rc.d/init.d/mysqld
basedir=/usr/local/mysql
datadir=/data/mysql
vi /etc/profile
export PATH=$PATH:/usr/local/mysql/bin
source /etc/profile
ln -s /usr/local/mysql/lib/mysql /usr/lib/mysql
ln -s /usr/local/mysql/include/mysql /usr/include/mysql
mkdir /var/lib/mysql
ln -s /tmp/mysql.sock /var/lib/mysql/mysql.sock
#配置my.cnf
vi /usr/local/mysql/my.cnf
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
[mysqld]
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
# These are commonly set, remove the # and set as required.
basedir = /usr/local/mysql
datadir = /data/mysql
# port = .....
# server_id = .....
# socket = .....
character-set-server = utf8mb4
skip_name_resolve = 1
open_files_limit = 3072
#back_log = 103
max_connections = 512
#max_connect_errors = 100000
#table_open_cache = 512
#external-locking = FALSE
max_allowed_packet = 32M
sort_buffer_size = 2M
join_buffer_size = 2M
thread_cache_size = 51
#query_cache_size = 0
#query_cache_type = 0
default_storage_engine=InnoDB
default_tmp_storage_engine=InnoDB
tmp_table_size = 96M
max_heap_table_size = 96M
slow_query_log = 1
slow_query_log_file = /data/mysql/slow.log
#log-error = /data/mysql/error.log
#long_query_time = 0.1
#server-id = 1
#log-bin = /data/mysql
#sync_binlog = 1
#binlog_cache_size = 4M
#max_binlog_cache_size = 8M
#max_binlog_size = 1024M
expire_logs_days = 7
#master_info_repository = TABLE
#relay_log_info_repository = TABLE
#gtid_mode = on
#enforce_gtid_consistency = 1
#log_slave_updates
binlog_format = row
#relay_log_recovery = 1
key_buffer_size = 32M
read_buffer_size = 1M
read_rnd_buffer_size = 16M
bulk_insert_buffer_size = 64M
myisam_sort_buffer_size = 128M
#myisam_max_sort_file_size = 10G
#myisam_max_extra_sort_file_size = 10G
myisam_repair_threads = 1
myisam_recover
lock_wait_timeout = 300
#innodb_thread_concurrency = 0
binlog_format = row
#relay_log_recovery = 1
key_buffer_size = 32M
read_buffer_size = 1M
read_rnd_buffer_size = 16M
bulk_insert_buffer_size = 64M
myisam_sort_buffer_size = 128M
#myisam_max_sort_file_size = 10G
#myisam_max_extra_sort_file_size = 10G
myisam_repair_threads = 1
myisam_recover
lock_wait_timeout = 300
#innodb_thread_concurrency = 0
transaction_isolation = REPEATABLE-READ
innodb_additional_mem_pool_size = 16M
innodb_buffer_pool_size = 717M
innodb_buffer_pool_load_at_startup = 1
innodb_buffer_pool_dump_at_shutdown = 1
#innodb_data_file_path = ibdata1:1024M:autoextend
#innodb_flush_log_at_trx_commit = 1
innodb_log_buffer_size = 16M
#innodb_log_file_size = 2G
#innodb_log_files_in_group = 2
#innodb_io_capacity = 4000
#innodb_io_capacity_max = 8000
innodb_max_dirty_pages_pct = 50
innodb_flush_method = O_DIRECT
innodb_file_format = Barracuda
innodb_file_format_max = Barracuda
innodb_lock_wait_timeout = 10
innodb_rollback_on_timeout = 1
innodb_print_all_deadlocks = 1
innodb_file_per_table = 1
innodb_locks_unsafe_for_binlog = 0
[mysqldump]
quick
max_allowed_packet = 32M
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
service mysqld start
cd bin
#设置密码 111111
mysql_secure_installation
#验证
mysql -uroot -p
use mysql;
update user set host = '%' where user ='root';
flush privileges;
#修改防火墙设置
vi /etc/sysconfig/iptables
在紧接着-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT 的下一行增加
#mysql
-A INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
准备源码包mysql-5.6.19.tar.gz ,上传至/opt 目录
groupadd mysql
useradd -g mysql mysql -s /bin/false
mkdir -p /data/mysql
chown -R mysql:mysql /data/mysql
mkdir -p /usr/local/mysql
yum -y install autoconf
cd mysql-5.6.19
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/mysql -DSYSCONFDIR=/etc
make && make install
cd /usr/local/mysql
./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql
rm -f /etc/my.cnf
ln -s /usr/local/mysql/my.cnf /etc/my.cnf
cp ./support-files/mysql.server /etc/rc.d/init.d/mysqld
chmod 755 /etc/init.d/mysqld
chkconfig mysqld on
vi /etc/rc.d/init.d/mysqld
basedir=/usr/local/mysql
datadir=/data/mysql
vi /etc/profile
export PATH=$PATH:/usr/local/mysql/bin
source /etc/profile
ln -s /usr/local/mysql/lib/mysql /usr/lib/mysql
ln -s /usr/local/mysql/include/mysql /usr/include/mysql
mkdir /var/lib/mysql
ln -s /tmp/mysql.sock /var/lib/mysql/mysql.sock
#配置my.cnf
vi /usr/local/mysql/my.cnf
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
[mysqld]
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
# These are commonly set, remove the # and set as required.
basedir = /usr/local/mysql
datadir = /data/mysql
# port = .....
# server_id = .....
# socket = .....
character-set-server = utf8mb4
skip_name_resolve = 1
open_files_limit = 3072
#back_log = 103
max_connections = 512
#max_connect_errors = 100000
#table_open_cache = 512
#external-locking = FALSE
max_allowed_packet = 32M
sort_buffer_size = 2M
join_buffer_size = 2M
thread_cache_size = 51
#query_cache_size = 0
#query_cache_type = 0
default_storage_engine=InnoDB
default_tmp_storage_engine=InnoDB
tmp_table_size = 96M
max_heap_table_size = 96M
slow_query_log = 1
slow_query_log_file = /data/mysql/slow.log
#log-error = /data/mysql/error.log
#long_query_time = 0.1
#server-id = 1
#log-bin = /data/mysql
#sync_binlog = 1
#binlog_cache_size = 4M
#max_binlog_cache_size = 8M
#max_binlog_size = 1024M
expire_logs_days = 7
#master_info_repository = TABLE
#relay_log_info_repository = TABLE
#gtid_mode = on
#enforce_gtid_consistency = 1
#log_slave_updates
binlog_format = row
#relay_log_recovery = 1
key_buffer_size = 32M
read_buffer_size = 1M
read_rnd_buffer_size = 16M
bulk_insert_buffer_size = 64M
myisam_sort_buffer_size = 128M
#myisam_max_sort_file_size = 10G
#myisam_max_extra_sort_file_size = 10G
myisam_repair_threads = 1
myisam_recover
lock_wait_timeout = 300
#innodb_thread_concurrency = 0
binlog_format = row
#relay_log_recovery = 1
key_buffer_size = 32M
read_buffer_size = 1M
read_rnd_buffer_size = 16M
bulk_insert_buffer_size = 64M
myisam_sort_buffer_size = 128M
#myisam_max_sort_file_size = 10G
#myisam_max_extra_sort_file_size = 10G
myisam_repair_threads = 1
myisam_recover
lock_wait_timeout = 300
#innodb_thread_concurrency = 0
transaction_isolation = REPEATABLE-READ
innodb_additional_mem_pool_size = 16M
innodb_buffer_pool_size = 717M
innodb_buffer_pool_load_at_startup = 1
innodb_buffer_pool_dump_at_shutdown = 1
#innodb_data_file_path = ibdata1:1024M:autoextend
#innodb_flush_log_at_trx_commit = 1
innodb_log_buffer_size = 16M
#innodb_log_file_size = 2G
#innodb_log_files_in_group = 2
#innodb_io_capacity = 4000
#innodb_io_capacity_max = 8000
innodb_max_dirty_pages_pct = 50
innodb_flush_method = O_DIRECT
innodb_file_format = Barracuda
innodb_file_format_max = Barracuda
innodb_lock_wait_timeout = 10
innodb_rollback_on_timeout = 1
innodb_print_all_deadlocks = 1
innodb_file_per_table = 1
innodb_locks_unsafe_for_binlog = 0
[mysqldump]
quick
max_allowed_packet = 32M
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
service mysqld start
cd bin
#设置密码 111111
mysql_secure_installation
#验证
mysql -uroot -p
use mysql;
update user set host = '%' where user ='root';
flush privileges;
#修改防火墙设置
vi /etc/sysconfig/iptables
在紧接着-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT 的下一行增加
#mysql
-A INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
相关文章推荐
- MySQL中的integer 数据类型
- MySQL存储过程
- mysql中int、bigint、smallint 和 tinyint的区别与长度
- mysql load data 导出、导入 csv
- source命令执行SQL脚本文件
- MySQL创建用户及权限控制
- MySQL管理数据表
- linux下mysql添加用户
- mysql procedure
- mysql触发器
- MySQL 备份和恢复策略
- mac下安装mysql(转载)
- mysql 修改编码 Linux/Mac/Unix/通用(杜绝修改后无法启动的情况!)
- MySQL数据的导出、导入(mysql内部命令:mysqldump、mysql)
- mysql数据行转列
- Linux下修改MySQL编码的方法
- MySQL Server 日志
- MySQL 安全事宜
- MySQL 备份与恢复