mysql5.6 centos编译部署
准备工作
创建用户
useradd mysql
删除老版本
rpm -qa |grep mysql
rep -e mysql包
重命名默认的mysql配置文件
mv /etc/my.cnf /etc/my.cnf.old
下载mysql
wget http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.35.tar.gz
安装依赖
yum -y install make gcc-c++ cmake bison-devel ncurses-devel
安装配置
解压
tar -xf mysql-5.6.35.tar.gz
cd mysql-5.6.35
编译安装
cmake \
-DCMAKE_INSTALL_PREFIX=/home/heron/mysql-3306 \
-DMYSQL_DATADIR=/home/heron/mysql/data \
-DMYSQL_UNIX_ADDR=/home/heron/mysql-3306/mysql-3306.sock \
-DSYSCONFDIR=/home/heron/mysql-3306/etc \
-DDEFAULT_CHARSET=utf8 \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DMYSQL_TCP_PORT=3306 \
-DWITH_READLINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci
make -j8 && make -j8 install
配置启动
cd /home/heron/mysql-3306/
mkdir logs etc tmp var
初始化
vim /home/heron/mysql-3306/etc/my.cnf
这个配置有关于复制相关的配置,不用复制的话,请忽略,需要从库只需修改配置server-id并打开read
[client]
port = 3309
socket = /home/xiaohe/mysql-3309/mysql.sock
[mysql]
prompt="\u@XH-TEST-01:3309>"
no-auto-rehash
[mysqld]
user = nobody
port = 3309
socket = /home/xiaohe/mysql-3309/mysql.sock
basedir = /home/xiaohe/mysql-3309
datadir = /home/xiaohe/mysql-3309/data
pid-file = /home/xiaohe/mysql-3309/mysql.pid
log-error = /home/xiaohe/mysql-3309/logs/mysql.err
tmpdir = /home/xiaohe/mysql-3309/tmp/
slave-load-tmpdir = /home/xiaohe/mysql-3309/tmp/
character-set-server = utf8mb4
skip_name_resolve = 1
open_files_limit = 65535
back_log = 1024
max_connections = 3000
max_connect_errors = 100000
table_open_cache = 2048
table_definition_cache = 2048
table_open_cache_instances = 64
thread_stack = 512K
external-locking = FALSE
max_allowed_packet = 32M
sort_buffer_size = 16M
join_buffer_size = 16M
thread_cache_size = 300
query_cache_size = 0
query_cache_type = 0
tmp_table_size = 96M
max_heap_table_size = 96M
slow_query_log = 1
slow_query_log_file = /home/xiaohe/mysql-3309/logs/slow.log
long_query_time = 0.1
server-id = 11
read-only
#忽略记录,建议不忽略
#binlog-ignore-db=mysql
#binlog-ignore-db=information_schema
#binlog-ignore-db=performance_schema
#忽略复制,建议开启
#replicate-ignore-db=mysql
replicate-ignore-db=information_schema
replicate-ignore-db=performance_schema
#忽略表复制
#replicate-wild-ignore-table=mysql.%
replicate-wild-ignore-table=information_schema.%
replicate-wild-ignore-table=performance_schema.%
log-bin = /home/xiaohe/mysql-3309/data/mysql-bin
#允许的服务器
sync_binlog = 1
binlog_cache_size = 4M
max_binlog_cache_size = 2G
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
relay-log-purge = 1
key_buffer_size = 32M
read_buffer_size = 8M
read_rnd_buffer_size = 16M
bulk_insert_buffer_size = 64M
myisam_sort_buffer_size = 128M
myisam_repair_threads = 1
myisam_recover
lock_wait_timeout = 300
explicit_defaults_for_timestamp = 1
metadata_locks_hash_instances = 64
innodb_thread_concurrency = 0
transaction_isolation = REPEATABLE-READ
#innodb_additional_mem_pool_size = 16M
innodb_buffer_pool_size = 5734M
innodb_buffer_pool_instances = 8
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 = 2
innodb_log_buffer_size = 32M
innodb_log_file_size = 2G
innodb_log_files_in_group = 2
innodb_data_home_dir = /home/xiaohe/mysql-3309/data/
innodb_log_group_home_dir = /home/xiaohe/mysql-3309/data/
# 根据您的服务器IOPS能力适当调整
# 一般配普通SSD盘的话,可以调整到 10000 - 20000
# 配置高端PCIe SSD卡的话,则可以调整的更高,比如 50000 - 80000
innodb_io_capacity = 4000
innodb_io_capacity_max = 8000
innodb_open_files = 384
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 = 0
innodb_online_alter_log_max_size = 4G
innodb_status_file = 1
#performance_schema
performance_schema = 1
performance_schema_instrument = '%=on'
#innodb monitor
innodb_monitor_enable="module_innodb"
innodb_monitor_enable="module_server"
innodb_monitor_enable="module_dml"
innodb_monitor_enable="module_ddl"
innodb_monitor_enable="module_trx"
innodb_monitor_enable="module_os"
innodb_monitor_enable="module_purge"
innodb_monitor_enable="module_log"
innodb_monitor_enable="module_lock"
innodb_monitor_enable="module_buffer"
innodb_monitor_enable="module_index"
innodb_monitor_enable="module_ibuf_system"
innodb_monitor_enable="module_buffer_page"
innodb_monitor_enable="module_adaptive_hash"
[mysqldump]
quick
max_allowed_packet = 64M
初始化
/home/heron/mysql-3306/scripts/mysql_install_db
/home/heron/mysql-3307/scripts/mysql_install_db
如果报错
FATAL ERROR: please install the following Perl modules before executing /home/heron/mysql-3306/scripts/mysql_install_db:
安装下面的包
yum install -y perl-Module-Install.noarch
启动
/home/heron/mysql-3306/bin/mysqld_safe &
/home/heron/mysql-3307/bin/mysqld_safe &
建议使用supervisor管理
[program:mysql-3306]
command= /home/heron/mysql-3306/bin/mysqld --defaults-file=/home/heron/mysql-3306/etc/my.cnf
directory=/home/heron/mysql-3306
user=heron
[program:mysql-3307]
command= /home/heron/mysql-3307/bin/mysqld --defaults-file=/home/heron/mysql-3307/etc/my.cnf
directory=/home/heron/mysql-3307
user=heron
默认没有密码 设置root密码
SET PASSWORD = PASSWORD('123456');
安装告一段落
主从同步
创建同步账号
登录主库
GRANT RELOAD, REPLICATION SLAVE, SUPER ON . TO 'slave'@'127.0.0.1' IDENTIFIED BY '123456';
flush privileges;
查看主库状态
root@localhost 19:25: [(none)]> show master status;
+------------------+----------+--------------+------------------+------------------------------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------------------+----------+--------------+------------------+------------------------------------------+
| mysql-bin.000004 | 1638 | | | c0d14e5b-f8e7-11e6-a9ed-001c42f6626e:1-7 |
+------------------+----------+--------------+------------------+------------------------------------------+
登录从库
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='slave', MASTER_PASSWORD='123456', MASTER_PORT=3306, MASTER_LOG_FILE='mysql-bin.000004', MASTER_LOG_POS=1638, MASTER_CONNECT_RETRY=5, MASTER_HEARTBEAT_PERIOD=3;
开启slave
start slave
查看slave
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
有这两项就说明成功了。
至此 MySQL5.6的安装、配置、启动、主从就完成了。
mysql5.6 centos编译部署的更多相关文章
- 手动编译部署LNMP环境(CentOS7.5+Nginx-1.18.0+MySQL-5.7.30+PHP-7.4.14)
在平时运维工作中,经常需要用到LNMP应用框架.LNMP环境是指在Linux系统下,由Nginx + MySQL + PHP组成的网站服务器架构. 可参考前面的文章: 如何在CentOS 7上搭建LA ...
- CentOS 7 编译部署LAMP环境
文章目录 1.需求以及环境准备 1.1.版本需求 1.2.环境准备 1.3.安装包准备 2.编译升级Openssl 2.1.查看当前Openssl版本 2.2.备份当前版本Openssl文件 2.3. ...
- 阿里云CentOS 7.4 64位,jdk1.6、mysql5.7、tomcat6部署步骤(个人记录)
jdk1.6.mysql5.7.tomcat6部署步骤 一.安装jdk1.6 查看当前系统jdk的版本:java -version 方法一:利用yum源来安装jdk(此方法不需要配置环境变量) 查看y ...
- 烂泥:mysql5.5多实例部署
本文由秀依林枫提供友情赞助,首发于烂泥行天下. mysql5.5数据库多实例部署,我们可以分以下几个步骤来完成. 1. mysql多实例的原理 2. mysql多实例的特点 3. mysql多实例应用 ...
- CentOS6系统编译部署LAMP(Linux, Apache, MySQL, PHP)环境
我们一般常规的在Linux服务器中配置WEB系统会用到哪种WEB引擎呢?Apache还是比较常用的引擎之一.所以,我们在服务器中配置LAMP(Linux, Apache, MySQL, PHP)是我们 ...
- rhel6+apache2.4+mysql5.7+php5.6部署LAMP架构
rhel6+apache2.4+mysql5.7+php5.6部署LAMP架构 2017年10月01日 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~准备阶段~~~~~~~~~~~~~ ...
- Centos7+PHP5.6+MySQL5.7+Zabbix4.0部署
Centos7+PHP5.6+MySQL5.7+Zabbix4.0部署 系统版本:CentOS Linux release 7.4.1708 (Core) 最小化安装 内核版本:3.10.0-693. ...
- CentOS 7 部署 ASP.NET Core 应用程序
原文:CentOS 7 部署 ASP.NET Core 应用程序 看了几篇大牛写的关于 Linux 部署 ASP.NET Core 程序的文章,今天来实战演练一下.2017年最后一个工作日,提前预祝大 ...
- CentOS编译安装NodeJS+Express
NodeJS是基于Chrome’s Javascript runtime,也就是Google V8引擎执行Javascript的快速构建网络服务及应用的平台,其优点有: 在CentOS编译安装Node ...
随机推荐
- npm install 错误 安装 chromedriver 失败的解决办法
npm 安装 chromedriver 失败的解决办法npm 安装 chromedriver 时,偶尔会出错,错误提示类似于:npm ERR! chromedriver@2.35.0 install: ...
- 管理菜单 结贴回复 来自 202.112.36.253 的回复: TTL 传输中过期
发表于 2010-08-26 18:29:14 楼主 其实标题是我执行如下命令时的输出:C:\Users\ChenWeiguang>ping 218.198.81.190 正在 Ping 218 ...
- 六种常见排序算法的java实现
package edu.cn.ysw; //八种排序算法的实现与效率分析 /* * 内排序的种类: * 1.插入排序:直接插入排序.希尔排序. * 2.选择排序:简单选择排序.堆排序. 3.交换排序: ...
- P - Air Raid
来源poj1422 Consider a town where all the streets are one-way and each street leads from one intersect ...
- L - Father Christmas flymouse
来源poj3160 After retirement as contestant from WHU ACM Team, flymouse volunteered to do the odds and ...
- JS创建对象的几种方式整理
javascript是一种“基于prototype的面向对象语言“,与java有非常大的区别,无法通过类来创建对象.那么,既然是面象对象的,如何来创建对象呢? 一:通过“字面量”方式创建对象 方法:将 ...
- spring-boot(三) HowTo
Spring Boot How To 1. 简介 本章节将回答一些常见的"我该怎么做"类型的问题,这些问题在我们使用spring Boot时经常遇到.这绝不是一个详尽的列表,但它覆 ...
- redis(四)--简单实现Redis缓存中的排序功能
在实现缓存排序功能之前,必须先明白这一功能的合理性.不妨思考一下,既然可以在数据库中排序,为什么还要把排序功能放在缓存中实现呢?这里简单总结了两个原因:首先,排序会增加数据库的负载,难以支撑高并发的应 ...
- php框架中,try,catch不能用的问题(转载)
本文转自:http://blog.csdn.net/sangjinchao/article/details/71436557 最近再用laravel框架发现,try catch用了没有效果,依然不能阻 ...
- java.sql.SQLException: Field 'id' doesn't have a default value(用eclipse操作数据库时报了这种奇怪的错误)的原因与解决方法
1.错误原因 由于id在数据库表中是作为主键,但是在插入的过程中,没有给予数值,并且没有让其自增 2.解决办法 修改数据库表中的id,让其自增(在插入的过程中,不插入id数据时)