CentOS6.3下源码安装MySQL GA 5.6.10

[comment]在编译安装 MySQL 5.6.x 之前,需要最少安装的包有:bison,gcc、gcc-c++、cmake、ncurses-devel,
安装这些依赖包后,把原来解压出来的mysql源码目录删除掉,再重新解压出来,再去编译.

-- 0
Download mysql-5.6.10.tar.gz in dev.mysql.com

-- 1 安装cmake软件包
tar xzvf cmake-2.8.3.tar.gz 
./bootstrap   
gmake   
gmake install


-- 2 create account of mysql
groupadd mysql           
useradd -g mysql mysql           
autoreconf --force --install
libtoolize --automake --force
automake --force --add-missing

-- 3  complie the sources
mkdir -p /data/mbdata
tar xvfz mysql-5.5.20.tar.gz 
yum --install cmake
time cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql56 -DMYSQL_DATADIR=/data56 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DMYSQL_UNIX_ADDR==/data56/mysql.sock -DMYSQL_USER=mysql -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci

-- 4 build the db directy
time make 
time make install

-- 5 init db
ll /usr/local/mysql56/
cd /usr/local/mysql56/
chown -R mysql .
chgrp -R mysql .
cp support-files/my-default.cnf /etc/my56.cnf
scripts/mysql_install_db  --user=mysql --basedir=/usr/local/mysql56 --datadir=/data56 --defaults-file=/etc/my56.cnf

[root@mysql mysql56]# scripts/mysql_install_db  --user=mysql --basedir=/usr/local/mysql56 --datadir=/data56 --defaults-file=/etc/my56.cnf
WARNING: The host 'mysql.yest.nos' could not be looked up with /usr/local/mysql56/bin/resolveip.
This probably means that your libc libraries are not 100 % compatible
with this binary MySQL version. The MySQL daemon, mysqld, should work
normally with the exception that host name resolving will not work.
This means that you should use IP addresses instead of hostnames
when specifying MySQL privileges !

Installing MySQL system tables...2013-02-08 04:31:20 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2013-02-08 04:31:20 63040 [Note] InnoDB: The InnoDB memory heap is disabled
2013-02-08 04:31:20 63040 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2013-02-08 04:31:20 63040 [Note] InnoDB: Compressed tables use zlib 1.2.3
2013-02-08 04:31:20 63040 [Note] InnoDB: CPU does not support crc32 instructions
2013-02-08 04:31:20 63040 [Note] InnoDB: Using Linux native AIO
2013-02-08 04:31:20 63040 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2013-02-08 04:31:20 63040 [Note] InnoDB: Completed initialization of buffer pool
2013-02-08 04:31:20 63040 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2013-02-08 04:31:20 63040 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2013-02-08 04:31:20 63040 [Note] InnoDB: Database physically writes the file full: wait...
2013-02-08 04:31:20 63040 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
2013-02-08 04:31:20 63040 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
2013-02-08 04:31:20 63040 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2013-02-08 04:31:20 63040 [Warning] InnoDB: New log files created, LSN=45781
2013-02-08 04:31:20 63040 [Note] InnoDB: Doublewrite buffer not found: creating new
2013-02-08 04:31:21 63040 [Note] InnoDB: Doublewrite buffer created
2013-02-08 04:31:21 63040 [Note] InnoDB: 128 rollback segment(s) are active.
2013-02-08 04:31:21 63040 [Warning] InnoDB: Creating foreign key constraint system tables.
2013-02-08 04:31:21 63040 [Note] InnoDB: Foreign key constraint system tables created
2013-02-08 04:31:21 63040 [Note] InnoDB: Creating tablespace and datafile system tables.
2013-02-08 04:31:21 63040 [Note] InnoDB: Tablespace and datafile system tables created.
2013-02-08 04:31:21 63040 [Note] InnoDB: Waiting for purge to start
2013-02-08 04:31:21 63040 [Note] InnoDB: 1.2.10 started; log sequence number 0
2013-02-08 04:31:26 63040 [Note] Binlog end
2013-02-08 04:31:26 63040 [Note] InnoDB: FTS optimize thread exiting.
2013-02-08 04:31:26 63040 [Note] InnoDB: Starting shutdown...
2013-02-08 04:31:28 63040 [Note] InnoDB: Shutdown completed; log sequence number 1625977
OK

Filling help tables...2013-02-08 04:31:28 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2013-02-08 04:31:28 63063 [Note] InnoDB: The InnoDB memory heap is disabled
2013-02-08 04:31:28 63063 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2013-02-08 04:31:28 63063 [Note] InnoDB: Compressed tables use zlib 1.2.3
2013-02-08 04:31:28 63063 [Note] InnoDB: CPU does not support crc32 instructions
2013-02-08 04:31:28 63063 [Note] InnoDB: Using Linux native AIO
2013-02-08 04:31:28 63063 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2013-02-08 04:31:28 63063 [Note] InnoDB: Completed initialization of buffer pool
2013-02-08 04:31:28 63063 [Note] InnoDB: Highest supported file format is Barracuda.
2013-02-08 04:31:28 63063 [Note] InnoDB: 128 rollback segment(s) are active.
2013-02-08 04:31:28 63063 [Note] InnoDB: Waiting for purge to start
2013-02-08 04:31:28 63063 [Note] InnoDB: 1.2.10 started; log sequence number 1625977
2013-02-08 04:31:28 63063 [Note] Binlog end
2013-02-08 04:31:28 63063 [Note] InnoDB: FTS optimize thread exiting.
2013-02-08 04:31:28 63063 [Note] InnoDB: Starting shutdown...
2013-02-08 04:31:30 63063 [Note] InnoDB: Shutdown completed; log sequence number 1625987
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

  /usr/local/mysql56/bin/mysqladmin -u root password 'new-password'
  /usr/local/mysql56/bin/mysqladmin -u root -h mysql.yest.nos password 'new-password'

Alternatively you can run:

  /usr/local/mysql56/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:

  cd . ; /usr/local/mysql56/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl

  cd mysql-test ; perl mysql-test-run.pl

Please report any problems with the ./bin/mysqlbug script!

The latest information about MySQL is available on the web at

  http://www.mysql.com

Support MySQL by buying support/licenses at http://shop.mysql.com

New default config file was created as /usr/local/mysql56/my.cnf and
will be used by default by the server when you start it.
You may edit this file to change server settings


-- 6 copy start command

cp support-files/mysql.server /etc/init.d/mysqld56
chmod 700 /etc/init.d/mysqld56
echo "export PATH=$PATH:/usr/local/mysql56/bin">>/etc/profile 
source /etc/profile

 

 

-- 7 add command to system parameter
cd /data/mbdata
chkconfig --add mysqld56

-- 8  start service 
service mysqld56 start


- ==================================================================
【PS】半同步复制
-- =================================================================
MySQL AB复制原理:
Master 服务器 (主服务器) 通过把所有涉及到数据库更新操作都记录到二进制日志当中,
然后Slave 服务器(从服务器)就会通过IO_THREAD线程如连接主服务器,然后主服务器会通过IO_THREAD应答从服务器,然后开始传输二进制日志。从服务器接受到相应的日志记录之后,就会通过SQL_THREAD线程去执行日志当中记录的更改.

实现的级别:row level,statement level,mixed level
复制时延性:异步复制(MySQL AB复制天然属性),实时复制(MySQL + DRBD),半同步复制(>=5.5版本之后才有,暂时不算完善)

1、安装半同步复制的模块

master> install plugin rpl_semi_sync_master soname 'semisync_master.so';  参数rpl_semi_sync_master_enabled=1 才生效。如果在安装的时候不注释掉,会报unknown variable 'rpl_semi_sync_master_enabled=1'的错误。

slave1> install plugin rpl_semi_sync_slave soname 'semisync_slave.so';

2、激活半同步复制
master> set global rpl_semi_sync_master_enabled = on;

slave> set global rpl_semi_sync_slave_enabled = on;
slave> stop slave IO_THREAD;
slave> start slave IO_THREAD;

master> show status like ‘rpl_semi_sync_master_status’;
+—————————–+——-+
| Variable_name | Value |
+—————————–+——-+
| Rpl_semi_sync_master_status | ON |
+—————————–+——-+

master> show status like ‘rpl_semi_sync_master_clients’;
+——————————+——-+
| Variable_name | Value |
+——————————+——-+
| Rpl_semi_sync_master_clients | 1 | <---说明一个从服务器是使用半同步模式
+------------------------------+-------+

3、确定正在使用半同步模式
master> insert into user values (8,’moto’);
master> show status like ‘Rpl_semi_sync_master_yes_tx’;
+—————————–+——-+
| Variable_name | Value |
+—————————–+——-+
| Rpl_semi_sync_master_yes_tx | 1 | <– 数值代表有多少个事务被从服务器确认
+—————————–+——-+

验证:
关闭master的网络,然后提交更新数据,发现会等待10秒才返回,因为主服务器在等待从服务器的确认,10秒之后超时,就会返回,主服务器会恢复到异步模式。


你可能感兴趣的:(CentOS6.3下源码安装MySQL GA 5.6.10)