bitsCN.com
安装环境
centos 5.4
mysql 5.1.xx 采用rpm直接安装
xtrabackup 1.2.22 采用rpm直接安装
[mysqld]
server-id = 1
log-bin
innodb_flush_log_at_trx_commit=1
sync_binlog=1
datadir=/var/lib/mysql
character-set-server=utf8
init_connect='SET NAMES utf8'
设定了默认字符集为utf8,可以按实际情况取舍这段配置。
2. Slave:/etc/my.cnf
[mysqld]
server-id=2
datadir=/var/lib/mysql
character-set-server=utf8
init_connect='SET NAMES utf8'
3. Master:在master数据库设置用来同步的slave用户权限
GRANT REPLICATION SLAVE ON *.*
TO '
IDENTIFIED BY '
4. Master:导出数据到slave
采用xtrabackup来备份mysql,好处是在master的锁表时间很短,在实际的生产环境也可以使用,并且xtrabackup会自动记录同步日志文件的位置。
sudo innobackupex-1.5.1 --stream=tar /tmp/ | ssh
这个步骤会把master的数据包括表结构整个导出并压缩复制给slave,同时解压到slave的/tmp/db目录下。
5. Slave:导入数据到slave
innobackupex-1.5.1 --apply-log /tmp/db
innobackupex-1.5.1 --copy-back /tmp/db
chown -R mysql.mysql /var/lib/mysql/*
6. Slave:开始同步数据
查看/var/lib/mysql/xtrabackup_binlog_info,获得日志文件以及position。
CHANGE MASTER TO
MASTER_HOST='
MASTER_USER='
MASTER_PASSWORD='
MASTER_LOG_FILE='
MASTER_LOG_POS=
START SLAVE;
原始出处 http://www.ooso.net/archives/547bitsCN.com

本篇文章给大家带来了关于mysql的相关知识,其中主要介绍了关于架构原理的相关内容,MySQL Server架构自顶向下大致可以分网络连接层、服务层、存储引擎层和系统文件层,下面一起来看一下,希望对大家有帮助。

在mysql中,可以利用char()和REPLACE()函数来替换换行符;REPLACE()函数可以用新字符串替换列中的换行符,而换行符可使用“char(13)”来表示,语法为“replace(字段名,char(13),'新字符串') ”。

方法:1、利用right函数,语法为“update 表名 set 指定字段 = right(指定字段, length(指定字段)-1)...”;2、利用substring函数,语法为“select substring(指定字段,2)..”。

mysql的msi与zip版本的区别:1、zip包含的安装程序是一种主动安装,而msi包含的是被installer所用的安装文件以提交请求的方式安装;2、zip是一种数据压缩和文档存储的文件格式,msi是微软格式的安装包。

转换方法:1、利用cast函数,语法“select * from 表名 order by cast(字段名 as SIGNED)”;2、利用“select * from 表名 order by CONVERT(字段名,SIGNED)”语句。

本篇文章给大家带来了关于mysql的相关知识,其中主要介绍了关于MySQL复制技术的相关问题,包括了异步复制、半同步复制等等内容,下面一起来看一下,希望对大家有帮助。

本篇文章给大家带来了关于mysql的相关知识,其中主要介绍了mysql高级篇的一些问题,包括了索引是什么、索引底层实现等等问题,下面一起来看一下,希望对大家有帮助。

在mysql中,可以利用REGEXP运算符判断数据是否是数字类型,语法为“String REGEXP '[^0-9.]'”;该运算符是正则表达式的缩写,若数据字符中含有数字时,返回的结果是true,反之返回的结果是false。


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)
