Liunx 下MYSQL 5.7 二进制安装

Linux 下 MySQL 5.7 二进制安装

  数据库服务器操作系统配置可参看《Linux下MYSQL 5.6 源码安装https://www.cnblogs.com/doctormo/p/12019550.html

  这里采用的是 mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz, 可从MySQL官网 https://dev.mysql.com/downloads/mysql 下载5.7 版本。

1.1 安装必要的依赖包

# yum -y install gcc gcc-c++ make cmake automake autoconf libxml2 libxml2-devel zlib zlib-devel ncurses ncurses-devel numactl-devel numactl

1.2 创建目录和授权

# useradd mysql
# mkdir -p /data/my3306
# mkdir -p /u02/my3306/data
# mkdir -p /u02/my3306/log/iblog
# mkdir -p /u02/my3306/log/binlog
# mkdir -p  /u02/my3306/tmp
# mkdir -p /u02/my3306/run
# chown -R mysql.mysql /u02

1.3 解压

# cd /usr/local/src  ==>  mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz上传至此
# tar zxvf mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz
# mv mysql-5.7.22-linux-glibc2.12-x86_64 /usr/local/
# cd  /usr/local/
# ln -s mysql-5.7.22-linux-glibc2.12-x86_64 mysql
# chown -R mysql.mysql /usr/local/mysql

1.4 配置参数文件

# cat /u02/my3306/my.cnf
[client]
port=3306
socket=/u02/my3306/mysql.sock
default-character-set=utf8mb4

[mysql]
pid_file=/u02/my3306/run/mysqld.pid

[mysqld]
character-set-server=utf8mb4
collation-server=utf8mb4_general_ci
autocommit=1
general_log=off
explicit_defaults_for_timestamp=true
lower_case_table_names=1
#symbolic-links=0

#gtid
gtid-mode                = ON
enforce_gtid_consistency = 1
log_slave_updates        = 1

#sql_mode
sql_mode="STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"

# system
basedir=/usr/local/mysql
datadir=/u02/my3306/data
max_allowed_packet=1g
max_connections=3000
max_user_connections=2800
open_files_limit=65535
pid_file=/u02/my3306/run/mysqld.pid
port=3306
server_id=71693306
skip_name_resolve=ON
socket=/u02/my3306/run/mysql.sock
tmpdir=/u02/my3306/tmp

#binlog
log_bin=/u02/my3306/log/binlog/binlog
binlog_cache_size=32768
binlog_format=row
expire_logs_days=14
log_slave_updates=ON
max_binlog_cache_size=2147483648
max_binlog_size=524288000
sync_binlog=10

#logging
log_error=/u02/my3306/log/error.log
slow_query_log_file=/u02/my3306/log/slow.log
log_queries_not_using_indexes=0
slow_query_log=1
log_slave_updates=ON
log_slow_admin_statements=1
long_query_time=1
group_concat_max_len = 102400

#relay
relay_log=/u02/my3306/log/relaylog
relay_log_index=/u02/my3306/log/relay.index
relay_log_info_file=/u02/my3306/log/relay-log.info

#slave
slave_load_tmpdir=/u02/my3306/tmp
slave_skip_errors=OFF

#innodb
innodb_data_home_dir=/u02/my3306/log/iblog
innodb_log_group_home_dir=/u02/my3306/log/iblog
innodb_adaptive_flushing=ON
innodb_adaptive_hash_index=ON
innodb_autoinc_lock_mode=1
innodb_buffer_pool_instances=8

#default
innodb_change_buffering=inserts
innodb_checksums=ON
innodb_buffer_pool_size= 20G
innodb_data_file_path=ibdata1:1G:autoextend
innodb_doublewrite=ON
innodb_file_format=Barracuda
innodb_file_per_table=ON
innodb_flush_log_at_trx_commit=1
innodb_flush_method=O_DIRECT
innodb_io_capacity=1000
innodb_lock_wait_timeout=10
innodb_log_buffer_size=67108864
innodb_log_file_size=1048576000
innodb_log_files_in_group=4
innodb_max_dirty_pages_pct=60
innodb_open_files=60000
innodb_purge_threads=1
innodb_read_io_threads=4
innodb_stats_on_metadata=OFF
innodb_support_xa=ON
innodb_use_native_aio=OFF
innodb_write_io_threads=10

[mysqld_safe]
datadir=/u02/my3306/data

1.5 初始化数据库

# /usr/local/mysql/bin/mysqld --defaults-file=/u02/my3306/my.cnf --initialize --user=‘mysql‘ --log_error_verbosity --explicit_defaults_for_timestamp --basedir=/usr/local/mysql --datadir=/u02/my3306/data/# chown -R mysql.mysql /u02

1.6 启动数据库

$ su - mysql$ mysqld_safe --defaults-file=/u02/my3306/my.cnf &
$ grep passw /u02/my3306/log/error.log
2018-07-10T03:13:40.850685Z 1 [Note] A temporary password is generated for [email protected]: vh2yRx=Pguem
$ mysql -uroot -p -S /u02/my3306/run/mysql.sock
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.22-log

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.

mysql> set password=password(‘xxxxxxx‘);
mysql> flush privileges;

原文地址:https://www.cnblogs.com/doctormo/p/12019647.html

时间: 2024-08-29 14:27:16

Liunx 下MYSQL 5.7 二进制安装的相关文章

liunx下mysql数据库使用之三范式,关系模型设计注意项,安装目录结构

数据库的三范式第一范式===>每行记录的属性,是原子的,拆到不可拆为止.===>例如:一个人的籍贯,可以拆分为,省,市,县,乡,村 第二范式===>每行记录的非主属性(非主键属性),都完全依赖主属性(主键).===>每行的数据都能唯一区分.===>例如:一个学校的教师,他的姓名,年龄,性别,籍贯.都依赖它的教师编号===>而它教授的科目,并不依赖他的编号,则需要另建表,作为关系模型,进行存储 第三范式===>在实体关系中,如果不存在非关键字段对任一候选关键字段的函

数据库学习之--Linux下Mysql源码包安装

数据库学习之--Linux下Mysql源码包安装 系统环境: 操作系统:RedHat EL6 DB Soft:  Mysql 5.6.4-m7     Mysql 在linux下的安装方式有两种版本,一种为Binary(二进制),另外一种为Source(源码包),本文为Source Install方式. 1.安装前的准备 解压安装包 [[email protected] ~]$ ls mysql-5.6.4-m7  mysql-5.6.4-m7.tar.gz  mysql-5.6.4-m7.ta

Linux下MySQL的几种安装方式

闲来有空,整理下Linux下Mysql的几种安装方式,分别使用yum/rpm.常规方式编译安装.cmake方式编译安装以及使用二进制方式免编译安装MySQL Linux系统环境: CentOS release 6.5 (Final) x86_64 MySQL版本:5.5.45 安装前关闭了iptables.selinux为disabled 预安装以下包: yum groupinstall "debugging Tools" "Dial-up Networking Suppor

Liunx下Redis集群的安装与测试,以及项目中的应用(redis中对象和集合的储存)。

Liunx下Redis集群的安装与测试,以及项目中的应用. 首先准备ruby和redis接口: redis-3.0.0.gem和 去https://redis.io/下载 1.使用ruby脚本搭建集群.需要ruby的运行环境. 安装ruby yum install ruby yum install rubygems 1.1安装ruby脚本运行使用的包. [[email protected] ~]# gem install redis-3.0.0.gem Successfully installe

centos下mysql 最新版终于安装成功!备份一下几个关键地方

我本来只是为了搭建简单的LAMP环境,亲自动手,却发现有这么多的问题会发生.(by default7#zbphp.com) 很多地方给的安装Mysql的提示是通过yum一键安装.shell命令如下: yum install mysql yum install mysql-server yum install mysql-devel 但是,这个命令安装的mysql版本很旧,5.1.0x版本的,官网的Mysql已经是 5.6.x版本了.太旧了,记得08年的时候就出了 5.1的版本了. 坚持安装最新版

CentOS下Mysql双机热备安装详解

Mysql双机热备安装文档 1. 安装环境和资源 211.88.22.74 4CPU 8G 120G硬盘 centos6.5_64 211.88.22.73 4CPU 8G 120G硬盘 centos6.5_64 服务器两台.这里使用211.88.22.74作为主服务器,211.88.22.73作为从服务器. 1.1 mysql下载地址 a. 官方下载地址: http://dev.mysql.com/downloads/mysql/#downloads 或镜像文件下载: http://dev.m

centos下mysql源码编译安装和主备异步配置

安装机器:10.11.1.193.10.11.1.194 主备同步方式:异步同步 mysql版本:mysql community5.6.28 下载源码并解压: tar -zxf mysql-5.6.28.tar.gz cmake安装: 安装编译所需环境: sudo yum install make gcc-c++ cmake bison-develncurses-devel libaio libaio-devel net-tools perl 编译安装mysql cmake-DCMAKE_INS

Ubuntu 下 mysql 卸载后重安装时遇到的问题

卸载mysql报错解决方法1 dpkg: error processing mysql-server (--configure): dependency problems - leaving unconfigured start: Job failed to start invoke-rc.d: initscript mysql, action "start" failed. dpkg: error processing mysql-server-5.5 (--configure): 

Linux下mysql的部署和安装-RPM方式

RPM方式安装MySQL5.6 a. 检查MySQL及相关RPM包,是否安装,如果有安装,则移除(rpm –e 名称) [[email protected] ~]# rpm -qa | grep -i mysql mysql-libs-5.1.66-2.el6_3.x86_64 [[email protected] ~]# yum -y remove mysql-libs* b. 下载Linux对应的RPM包,如:CentOS6.4_64对应的RPM包,如下: [[email protected