1-Mysql 5.7.27数据库安装
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Mysql 5.7.27数据库安装
一、安装依赖包
yum install gcc gcc-c++ autoconf automake
yum -y install zlib zlib-devel openssl openssl-devel pcre pcre-devel
yum -y install gcc glibc libaio libstdc++ libstdc libncurses ld-linux
yum -y install make gcc-c++ cmake bison-devel ncurses-devel readline-devel libaio-devel perl libaio wget lrzsz vim libnuma* bzip2 xz
二、配置操作系统
(1)、关闭SElinux
setenforce 0
修改/etc/selinux/config
vim /etc/selinux/config
SELINUX=disabled
(2)、关闭防火墙
systemctl stop firewalld
systemctl disable firewalld
(3)sysctl.conf 优化:
cat >>/etc/sysctl.conf <<"EOF"
vm.swappiness=0
net.ipv4.tcp_max_syn_backlog = 65535 net.ipv4.tcp_max_tw_buckets = 8000 net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_fin_timeout = 10
net.ipv4.ip_local_port_range = 1024 65535 net.ipv4.tcp_max_syn_backlog = 4096 net.ipv4.tcp_fin_timeout = 30
net.core.somaxconn=65535
dev_max_backlog=65535 net.core.wmem_default=87380
net.core.wmem_max=16777216
net.core.rmem_default=87380
net.core.rmem_max=16777216
EOF
sysctl -p
(4) limit 优化:
cat >> /etc/security/limits.conf << EOF
#
###custom
#
* soft nofile 65535
* hard nofile 65535 * soft nproc 65535 * hard nproc 65535 EOF
cat>>/etc/pam.d/login < session required /lib/security/pam_limits.so session required pam_limits.so EOF cat>>/etc/profile< if [ $USER = "mysql" ]; then ulimit -u 16384 -n 65536 fi EOF 三、安装mysql 1、新建安装、数据库目录mkdir -p /oa/mysql8017 2、新建mysql用户 userdel mysql groupadd -g 4000 mysql useradd -u 4000 -g mysql mysql 3、环境变量 cat >>/home/mysql/.bash_profile< export PATH=/usr/local/mysql/bin:/usr/local/mysql/lib:$PATH EOF vi /etc/profile ----增加到后面 export MYSQL_HOME=/usr/local/mysql export PATH=$MYSQL_HOME/bin:$PATH 4、解压安装包 cd /soft unzip V982846-01.zip tar -zxvf mysql-advanced-5.7.27-el7-x86_64.tar.gz mv mysql-advanced-5.7.27-el7-x86_64 mysql 5、建立源文件链接 cd /usr/local ln -s /soft/mysql mysql 6、修改目录权限 chown -R mysql:mysql /usr/local/mysql chown -R mysql:mysql /soft/mysql chown -R mysql:mysql /oa/mysql8017 mkdir -p /oa/mysql8017/{data,log,binlog,conf,tmp} chown -R mysql.mysql /oa/mysql8017 7、配置简单的f 如果有f文件,先删除: rm -rf /etc/f vi /etc/f 增加如下内容: [mysqld] lower_case_table_names = 1 user = mysql server_id = 1104 port = 3306 enforce_gtid_consistency = ON gtid_mode = ON binlog_checksum = none default_authentication_plugin = mysql_native_password datadir = /oa/mysql8017/data pid-file = /oa/mysql8017/tmp/mysqld.pid socket = /oa/mysql8017/tmp/mysqld.sock tmpdir = /oa/mysql8017/tmp/ skip-name-resolve = ON table_open_cache = 2000 #################innodb######################## innodb_data_home_dir = /oa/mysql8017/data innodb_data_file_path = ibdata1:512M;ibdata2:512M:autoextend innodb_buffer_pool_size = 2000M innodb_flush_log_at_trx_commit = 1 innodb_io_capacity = 600 innodb_lock_wait_timeout = 120 innodb_log_buffer_size = 8M innodb_log_file_size = 200M