数据库学习之--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.tar.zip  ogg  oradiag_oracle  Readme--?+?.htm

[[email protected] ~]$ cd mysql-5.6.4-m7

[[email protected] mysql-5.6.4-m7]$ ls
BUILD        CMakeLists.txt   COPYING              extra               libmysql     mysql-test  README   sql-bench   support-files  vio
BUILD-CMAKE  cmd-line-utils   dbug                 include             libmysqld    mysys       regex    sql-common  tests          win
client       config.h.cmake   Docs                 INSTALL-SOURCE      libservices  packaging   scripts  storage     unittest       zlib
cmake        configure.cmake  Doxyfile-perfschema  INSTALL-WIN-SOURCE  man          plugin      sql      strings     VERSION

[[email protected] mysql-5.6.4-m7]$ tar zxvf mysql-5.6.4-m7.tar.gz

mysql-5.6.4-m7/mysql-test/lib/My/SafeProcess/
mysql-5.6.4-m7/mysql-test/lib/My/SafeProcess/safe_process.cc
mysql-5.6.4-m7/mysql-test/lib/My/SafeProcess/safe_kill_win.cc
mysql-5.6.4-m7/mysql-test/lib/My/SafeProcess/safe_process_win.cc
mysql-5.6.4-m7/mysql-test/lib/My/SafeProcess/Base.pm
mysql-5.6.4-m7/mysql-test/lib/My/SafeProcess/CMakeLists.txt
……

查看官方安装文档:INSTALL-SOURCE

 To install and use a MySQL binary distribution, the basic command

  sequence looks like this:

shell> groupadd mysql
shell> useradd -r -g mysql mysql
shell> cd /usr/local
shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz
shell> ln -s full-path-to-mysql-VERSION-OS mysql
shell> cd mysql
shell> chown -R mysql .
shell> chgrp -R mysql .
shell> scripts/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql data
# Next command is optional
shell> cp support-files/my-medium.cnf /etc/my.cnf
shell> bin/mysqld_safe --user=mysql &
# Next command is optional
shell> cp support-files/mysql.server /etc/init.d/mysql.server

 For example, with a compressed tar file source distribution on Unix, the basic installation command

sequence looks like this:

# Preconfiguration setup
shell> groupadd mysql
shell> useradd -r -g mysql mysql
# Beginning of source-build specific instructions
shell> tar zxvf mysql-VERSION.tar.gz
shell> cd mysql-VERSION
shell> cmake .
shell> make
shell> make install
# End of source-build specific instructions
# Postinstallation setup
shell> cd /usr/local/mysql
shell> chown -R mysql .
shell> chgrp -R mysql .
shell> scripts/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql data
# Next command is optional
shell> cp support-files/my-medium.cnf /etc/my.cnf
shell> bin/mysqld_safe --user=mysql &
# Next command is optional
shell> cp support-files/mysql.server /etc/init.d/mysql.server

2、准备源码安装所需要的工具和库文件(RedHat 安装光盘)

[[email protected] ~]# rpm -qa |grep make
automake-1.11.1-1.2.el6.noarch
make-3.81-19.el6.i686

[[email protected] ~]# rpm -qa |grep bison
bison-2.4.1-5.el6.i686

[[email protected] ~]# rpm -qa |grep gcc
gcc-c++-4.4.4-13.el6.i686
libgcc-4.4.4-13.el6.i686
gcc-4.4.4-13.el6.i686
gcc-gfortran-4.4.4-13.el6.i686
compat-libgcc-296-2.96-144.el6.i686

[[email protected] ~]# rpm -qa |grep cmake

[[email protected] ~]# rpm -qa |grep ncur
ncurses-base-5.7-3.20090208.el6.i686
ncurses-libs-5.7-3.20090208.el6.i686
ncurses-5.7-3.20090208.el6.i686
ncurses-devel-5.7-3.20090208.el6.i686

挂载RedHat安装光盘
[[email protected] ~]# mount /dev/cdrom /media/
mount: block device /dev/sr0 is write-protected, mounting read-only
[[email protected] ~]# cd /media/
[[email protected] media]# cd Server/
[[email protected] Server]# ls
Packages  repodata  TRANS.TBL
[[email protected] Server]# cd Packages/

[[email protected] Packages]# ls |grep make
automake-1.11.1-1.2.el6.noarch.rpm
cmake-2.6.4-5.el6.i686.rpm
imake-1.0.2-11.el6.i686.rpm
make-3.81-19.el6.i686.rpm
makebootfat-1.4-10.el6.i686.rpm
pacemaker-1.1.2-7.el6.i686.rpm
pacemaker-libs-1.1.2-7.el6.i686.rpm

安装cmake
[[email protected] Packages]# rpm -ivh /media/Server/Packages/cmake-2.6.4-5.el6.i686.rpm
warning: /media/Server/Packages/cmake-2.6.4-5.el6.i686.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing...                ########################################### [100%]
   1:cmake                  ########################################### [100%]
[[email protected] Packages]#

3、源码安装,检测编译环境

[[email protected] mysql-5.6.4-m7]# cmake ./

-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Looking for SHM_HUGETLB
-- Looking for SHM_HUGETLB - found
-- MySQL 5.6.4-m7
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found

......

-- Performing Test HAVE_IB_GCC_ATOMIC_BUILTINS
-- Performing Test HAVE_IB_GCC_ATOMIC_BUILTINS - Success
-- Performing Test HAVE_IB_ATOMIC_PTHREAD_T_GCC
-- Performing Test HAVE_IB_ATOMIC_PTHREAD_T_GCC - Success
-- Check size of pthread_t
-- Check size of pthread_t - done
-- Performing Test HAVE_PEERCRED
-- Performing Test HAVE_PEERCRED - Success
-- Googletest was not found. gtest-based unit tests will be disabled. You can run cmake . -DENABLE_DOWNLOADS=1 to automatically download and build required components from source.
-- If you are inside a firewall, you may need to use an http proxy: export http_proxy=http://foo.bar.com:80
-- Configuring done
-- Generating done
-- Build files have been written to: /home/oracle/mysql-5.6.4-m7

可以指定一下参数:

# -DCMAKE_INSTALL_PREFIX=/usr/local/mysql          \    #安装路径
# -DMYSQL_DATADIR=/usr/local/mysql/data            \    #数据文件存放位置
# -DSYSCONFDIR=/etc                                \    #my.cnf路径
# -DWITH_MYISAM_STORAGE_ENGINE=1                   \    #支持MyIASM引擎
# -DWITH_INNOBASE_STORAGE_ENGINE=1                 \    #支持InnoDB引擎
# -DWITH_MEMORY_STORAGE_ENGINE=1                   \    #支持Memory引擎
# -DWITH_READLINE=1                                \    #快捷键功能(我没用过)
# -DMYSQL_UNIX_ADDR=/tmp/mysqld.sock               \    #连接数据库socket路径
# -DMYSQL_TCP_PORT=3306                            \    #端口
# -DENABLED_LOCAL_INFILE=1                         \    #允许从本地导入数据
# -DWITH_PARTITION_STORAGE_ENGINE=1                \    #安装支持数据库分区
# -DEXTRA_CHARSETS=all                             \    #安装所有的字符集
# -DDEFAULT_CHARSET=utf8                           \    #默认字符
# -DDEFAULT_COLLATION=utf8_general_ci

4、编译

[[email protected] mysql-5.6.4-m7]# make

Scanning dependencies of target INFO_BIN
[  0%] Built target INFO_BIN
Scanning dependencies of target INFO_SRC
[  0%] Built target INFO_SRC
Scanning dependencies of target abi_check
[  0%] Built target abi_check
[  1%] Generating common.h
[  1%] Generating help.c
[  1%] Generating help.h
[  1%] Generating vi.h
[  1%] Generating emacs.h
[  1%] Generating fcns.c
[  1%] Generating fcns.h
Scanning dependencies of target edit
......

5、安装

[[email protected] mysql-5.6.4-m7]# make install

-- Installing: /usr/local/mysql/mysql-test/./extra/rpl_tests/rpl_row_sp003.test
-- Installing: /usr/local/mysql/mysql-test/./extra/rpl_tests/rpl_mts_crash_safe.inc
-- Installing: /usr/local/mysql/mysql-test/./extra/rpl_tests/rpl_stm_EE_err2.test
-- Installing: /usr/local/mysql/mysql-test/./extra/rpl_tests/rpl_ndb_apply_status.test
-- Installing: /usr/local/mysql/mysql-test/./extra/rpl_tests/rpl_mixing_engines.test
-- Installing: /usr/local/mysql/mysql-test/./extra/rpl_tests/rpl_extra_col_slave.test
-- Installing: /usr/local/mysql/mysql-test/./extra/rpl_tests/type_conversions.test
-- Installing: /usr/local/mysql/mysql-test/./extra/rpl_tests/rpl_row_func003.test
-- Installing: /usr/local/mysql/mysql-test/./extra/rpl_tests/rpl_row_sp002.test
......

@至此,mysql安装完成!

6、数据库配置

初始化数据库
[[email protected] mysql]#cd /usr/local/mysql
[[email protected] mysql]# ls
bin  COPYING  data  docs  include  INSTALL-BINARY  lib  man  mysql-5.6.4-m7  mysql-test  README  scripts  share  sql-bench  support-files

[[email protected] mysql]# chown -R mysql:mysql .

[[email protected] mysql]# scripts/mysql_install_db --user=mysql
Installing MySQL system tables...
140917 13:51:22 InnoDB: The InnoDB memory heap is disabled
140917 13:51:22 InnoDB: Mutexes and rw_locks use GCC atomic builtins
140917 13:51:22 InnoDB: Compressed tables use zlib 1.2.3
140917 13:51:22 InnoDB: Using Linux native AIO
140917 13:51:22 InnoDB: CPU does not support crc32 instructions
140917 13:51:22 InnoDB: Initializing buffer pool, size = 128.0M
140917 13:51:22 InnoDB: Completed initialization of buffer pool
InnoDB: The first specified data file ./ibdata1 did not exist:
InnoDB: a new database to be created!
140917 13:51:22 InnoDB: Setting file ./ibdata1 size to 10 MB
InnoDB: Database physically writes the file full: wait...

[[email protected] mysql]# chown -R mysql:mysql ./data
[[email protected] mysql]# chmod -R ug+rws .

[[email protected] mysql]# cp support-files/my-medium.cnf /etc/my.cnf
cp: overwrite `/etc/my.cnf‘? y

配置参数文件
[[email protected] mysql]# vi /etc/my.cnf
[mysqld]
port            = 3306
socket          = /tmp/mysql.sock
skip-external-locking
key_buffer_size = 16M
max_allowed_packet = 1M
table_open_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
user=mysql
datadir=/usr/local/mysql/data/mysql
default-storage-engine=MyISAM

7、启动数据库

[[email protected] mysql]# bin/mysqld_safe --user=mysql &

[1] 16592

[[email protected] mysql]# 140917 13:56:51 mysqld_safe Logging to ‘/usr/local/mysql/data/mysql/ogg.err‘.
140917 13:56:51 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data/mysql
140917 13:56:53 mysqld_safe mysqld from pid file /usr/local/mysql/data/mysql/ogg.pid ended
[1]+  Done                    bin/mysqld_safe --user=mysql
[[email protected] mysql]# ps -ef |grep mysql
root     16888  5955  0 13:57 pts/1    00:00:00 grep mysql

数据库启动失败!

查看日志:

[[email protected] mysql]# cat /usr/local/mysql/data/mysql/ogg.err

140917 13:56:51 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data/mysql
/usr/local/mysql/bin/mysqld: Table ‘mysql.plugin‘ doesn‘t exist
140917 13:56:51 [ERROR] Can‘t open the mysql.plugin table. Please run mysql_upgrade to create it.
140917 13:56:51 InnoDB: The InnoDB memory heap is disabled
140917 13:56:51 InnoDB: Mutexes and rw_locks use GCC atomic builtins
140917 13:56:51 InnoDB: Compressed tables use zlib 1.2.3
140917 13:56:51 InnoDB: Using Linux native AIO
140917 13:56:51 InnoDB: CPU does not support crc32 instructions
140917 13:56:51 InnoDB: Initializing buffer pool, size = 128.0M
140917 13:56:52 InnoDB: Completed initialization of buffer pool
InnoDB: The first specified data file ./ibdata1 did not exist:
InnoDB: a new database to be created!
140917 13:56:52 InnoDB: Setting file ./ibdata1 size to 10 MB
InnoDB: Database physically writes the file full: wait...
140917 13:56:52 InnoDB: Log file ./ib_logfile0 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile0 size to 5 MB
InnoDB: Database physically writes the file full: wait...
140917 13:56:52 InnoDB: Log file ./ib_logfile1 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile1 size to 5 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Doublewrite buffer not found: creating new
InnoDB: Doublewrite buffer created
140917 13:56:52 InnoDB: 128 rollback segment(s) are active.
InnoDB: Creating foreign key constraint system tables
InnoDB: Foreign key constraint system tables created
140917 13:56:52 InnoDB: Waiting for the background threads to start
140917 13:56:53 InnoDB: 1.2.4 started; log sequence number 0
140917 13:56:53 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 6c803c62-3e2f-11e4-9db1-0800270ccfcc.
140917 13:56:53 [ERROR] Fatal error: Can‘t open and lock privilege tables: Table ‘mysql.host‘ doesn‘t exist
140917 13:56:53 mysqld_safe mysqld from pid file /usr/local/mysql/data/mysql/ogg.pid ended

重新启动数据库

[[email protected] mysql]# cd bin

[[email protected] bin]# ./mysqld

./mysqld: Table ‘mysql.plugin‘ doesn‘t exist
140917 13:58:17 [ERROR] Can‘t open the mysql.plugin table. Please run mysql_upgrade to create it.
140917 13:58:17 InnoDB: The InnoDB memory heap is disabled
140917 13:58:17 InnoDB: Mutexes and rw_locks use GCC atomic builtins
140917 13:58:17 InnoDB: Compressed tables use zlib 1.2.3
140917 13:58:17 InnoDB: Using Linux native AIO
140917 13:58:17 InnoDB: CPU does not support crc32 instructions
140917 13:58:17 InnoDB: Initializing buffer pool, size = 128.0M
140917 13:58:17 InnoDB: Completed initialization of buffer pool
140917 13:58:17 InnoDB: highest supported file format is Barracuda.
InnoDB: Log scan progressed past the checkpoint lsn 48961
140917 13:58:17  InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
InnoDB: Doing recovery: scanned up to log sequence number 1595695
140917 13:58:17  InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progress in percents: 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
InnoDB: Apply batch completed
140917 13:58:17 InnoDB: 128 rollback segment(s) are active.
140917 13:58:17 InnoDB: Waiting for the background threads to start
140917 13:58:18 InnoDB: 1.2.4 started; log sequence number 1595695
140917 13:58:18 [Note] Recovering after a crash using mysql-bin
140917 13:58:18 [Note] Starting crash recovery...
140917 13:58:18 [Note] Crash recovery finished.
140917 13:58:18 [ERROR] Fatal error: Can‘t open and lock privilege tables: Table ‘mysql.host‘ doesn‘t exist

数据库启动失败 

140917 13:58:18 [ERROR] Fatal error: Can‘t open and lock privilege tables: Table ‘mysql.host‘ doesn‘t exist

解决方法:

修改/etc/my.cnf

[mysqld]

datadir=/var/lib/mysql

重新指定数据库数据文件的位置!

再次启动Database:

[[email protected] mysql]# bin/mysqld_safe --user=mysql &

[[email protected] data]# ps -ef |grep mysql
root     16955  5955  0 14:03 pts/1    00:00:00 /bin/sh ./mysqld_safe --user=mysql
mysql    17229 16955  0 14:03 pts/1    00:00:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/var/lib/mysql --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/var/lib/mysql/ogg.err --pid-file=/var/lib/mysql/ogg.pid --socket=/tmp/mysql.sock --port=3306

[[email protected] data]# netstat -an|grep 3306
tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN

数据库启动成功!

配置数据库启动脚本,加入系统启动环境

[[email protected] mysql]# cp support-files/mysql.server  /etc/init.d/mysql

[[email protected] mysql]# service mysql stop
Shutting down MySQL..140917 14:06:29 mysqld_safe mysqld from pid file /var/lib/mysql/ogg.pid ended
                                                           [  OK  ]
[1]+  Done                    ./mysqld_safe --user=mysql  (wd: /usr/local/mysql/bin)
(wd now: /usr/local/mysql)
[[email protected] data]# netstat -an|grep 3306

[[email protected] mysql]# service mysql start
Starting MySQL..   
[[email protected] data]# netstat -an|grep 3306
tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN                                        [  OK  ]

8、连接使用mysql database

修改管理员密码
[[email protected] mysql]# cd /usr/local/mysql/
[[email protected] mysql]# ./bin/mysqladmin -u root password
New password:
Confirm new password:

连接数据库
[[email protected] mysql]# ./bin/mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.4-m7-log Source distribution
Copyright (c) 2000, 2011, 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> select * from tab;
ERROR 1046 (3D000): No database selected

mysql> use mysql
Database changed

mysql> select * from tab;
ERROR 1146 (42S02): Table ‘mysql.tab‘ doesn‘t exist
mysql> select host,user from mysql.user;
+-----------+------+
| host      | user |
+-----------+------+
| 127.0.0.1 | root |
| ::1       | root |
| localhost |      |
| localhost | root |
| ogg       |      |
| ogg       | root |
+-----------+------+
6 rows in set (0.00 sec)
mysql>

@至此,mysql database安装、连接成功!


时间: 2024-08-02 02:43:56

数据库学习之--Linux下Mysql源码包安装的相关文章

linux下mysql源码包安装

1.下载下载地址: http://dev.mysql.com/downloads/mysql/5.6.html#downloads yeke 也可以直接复制下载命令 wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.22.tar.gz 2.安装依赖性文件 yum -y install cmake bison git ncurses-devel gcc gcc-c++ 3.创建用户组 groupadd mysql useradd

linux下PHP源码包安装

php在nginx环境下运行,所以我们要先配置nginx. 1.下载PHP源码包 ,解压. wget http://cn2.php.net/distributions/php-5.6.0.tar.xz xz -d php-5.6.0.tar.xz tar xf php-5.6.0.tar -C /usr/local/src/ 2.安装依赖性文件 yum install zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel yum i

Linux下基于源码方式安装MySQL 5.6

MySQL为开源数据库,因此可以基于源码实现安装.基于源码安装有更多的灵活性.也就是说我们可以针对自己的硬件平台选用合适的编译器来优化编译后的二进制代码,根据不同的软件平台环境调整相关的编译参数,选择自身需要选择不同的安装组件,设定需要的字符集等等一些可以根据特定应用场景所作的各种调整.本文描述了如何在源码方式下安装MySQL. 1.安装环境及介质#安装环境SZDB:~ # cat /etc/issueWelcome to SUSE Linux Enterprise Server 10 SP3

Linux 下MySQL源码安装完整版

在Linux中安装MySQL,通常为RPM与源码方式安装.对于生产环境而言,由于需要自定义诸如安装路径.数据文件位置.字符集以及支持的存储引擎等多以源码方式来进行安装.之前有写过一篇关于源码安装的文章,Linux下基于源码方式安装MySQL 5.6,但不是很完整,因此该文可以作为其补充.以下为具体安装步骤,供大家参考. 1.安装前的有关描述必备的包和工具  gcc/g++ :MySQL 5.6开始,需要使用g++进行编译.  cmake  :MySQL 5.5开始,使用cmake进行工程管理,c

mysql源码包安装方法

mysql安装前的准备工作 环境准备:linux系统  cmake   mysql安装包 卸载掉rpm包安装的mysql Yum -y remove mysql mysql-server Rm -rf /etc/my.cnf 安装解决依赖关系:yum -y install ncurses-devel openssl-devel bison gcc gcc-c++ mysql源码包安装 将源码包上传到/usr/local/src Tar xzf mysql安装包 yum -y install cm

linux卸载一个源码包安装的软件的流程

完全卸载memcached的方法(CentOS) 我的大内存vps(centos系统)曾经安装过memcached,想给论坛提速,实际上不但没有明显效果,反倒耗费内存,看着碍眼,于是想卸载,于是网上各种搜索+自己实践,搞出一个傻瓜方案来: 1.结束memcached进程# killall memcached 2.删除memcached目录及文件# rm -rf /usr/local/memcached# rm -f /etc/rc.d/init.d/memcached 3.关闭memcached

mysql 源码包安装

方法有: 1.专用软件包管理器包,如rpm 2.通用二进制格式的包,通常是用gcc,编译 3.源码包,需要编译安装5.5之前需要make安装5.5以后使用cmake安装. cmake,需要额外安装功能就需要用源码包 如需要定制 mysql5.5版本下载地址http://dev.mysql.com/downloads/mysql/5.5.html#downloads 不同的mysql rpm包介绍: MySQL-devel:mysql开发包.针对mysql进行二次开发使用 MySQL-embedd

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

mysql源码包安装以及主从搭建

MySQL越来越广泛的被使用,本文从MySQL的经典架构,mater - slave写起 本文使用的MySQL版本是MySQL-5.5.40 环境:centos 6.5 服务器A:172.16.100.81   作为MySQL的主服务器 服务器B:172.16.100.82   作为MySQL的从服务器 1,安装MySQL的依赖包 shell>yum -y install gcc-c++ cmake make ncurses-devel libaio 安装MySQL5.5以上的版本,需要使用cm