Mysql数据库安装及生产环境下主从库同步配置

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

Mysql数据库安装及生产环境下主从库同步配置

目录

1安装M YSQL数据库......................................................................................................................................

2生产环境下M Y SQL数据库主从同步配置.................................................................................................

2.1 主数据库配置 (5)

2.2 从数据库配置 (5)

3监控服务器...............................................................................................................................................

3.1 监控主数据库服务器 (6)

3.2 监控从数据库服务器 (6)

1安装Mysql数据库

安装环境:

系统:CentOS-6.6-x86_64

数据库:MySQL-server-5.5.42-1.el6.x86_64;MySQL-client-5.5.42-1.el6.x86_64

1.SSH方式登录到MySQL服务器

2.创建存放安装文件的目录

[root@localhost /]# mkdir -p /sw/mysql55

3.上传安装文件到上一步创建的目录

4.检查是否已安装过MySQL

[root@localhost /]# rpm -qa | grep -i mysql

MySQL-client-5.5.42-1.el6.x86_64

MySQL-server-5.5.42-1.el6.x86_64

5.如果已安装则移除,否则请跳过此步

[root@localhost /]# yum -y remove MySQL-server-5.5.42-1.el6.x86_64

[root@localhost /]# yum -y remove MySQL-client-5.5.42-1.el6.x86_64

删除老版本mysql的开发头文件和库

rm -fr /usr/lib/mysql

rm -fr /usr/include/mysql

rm -fr /var/lib/mysql

rm -f /etc/f

6.安装MySQL

[root@localhost /]# cd /sw/mysql55/

[root@localhost mysql55]# rpm -ivh MySQL-server-5.5.42-1.el6.x86_64.rpm

Preparing... ########################################### [100%] 1:MySQL-client ########################################### [100%] [root@localhost mysql55]# rpm -ivh MySQL-client-5.5.42-1.el6.x86_64.rpm

Preparing... ########################################### [100%] 1:MySQL-server ########################################### [100%]

7.配置MySQL

[root@localhost mysql55]# cp /usr/share/mysql/f /etc/f

[root@localhost mysql55]# vi /etc/f

[client]

#password = your_password

port = 8819

socket = /var/lib/mysql/mysql.sock

default-character-set=utf8

[mysqld]

port = 8819

socket = /var/lib/mysql/mysql.sock

lower_case_table_names=1

skip-external-locking

key_buffer_size = 384M

max_allowed_packet = 8M

table_open_cache = 512

sort_buffer_size = 2M

read_buffer_size = 2M

read_rnd_buffer_size = 8M

myisam_sort_buffer_size = 64M

thread_cache_size = 8M

query_cache_size = 32M

# Try number of CPU's*2 for thread_concurrency

thread_concurrency = 16

max_connections=10000

character-set-server=utf8

wait_timeout=31536000

interactive_timeout=31536000

user = mysql

default_storage_engine = InnoDB

pid-file = /var/lib/mysql/mysql.pid datadir = /var/lib/mysql/

log_bin = /var/lib/mysql/mysql-bin

log_error = /var/lib/mysql/mysql-error.log log_queries_not_using_indexes = 1

#second

long_query_time = 10

slow_query_log = 1

slow_query_log_file = /var/lib/mysql/mysql-slow.log server-id = 1

binlog_format=mixed

[mysqldump]

quick

max_allowed_packet = 16M

[mysql]

no-auto-rehash

default-character-set=utf8

[myisamchk]

key_buffer_size = 256M

sort_buffer_size = 256M

read_buffer = 2M

write_buffer = 2M

相关文档
最新文档