[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源码安装mysql5.6方法.pdf
centos6.3中编译安装mysql.5.5.30.pdf
centos6.3中编译安装mysql.5.5.30定义.pdf
centos6.3中编译安装mysql.5.5.30借鉴.pdf
centos6.3中编译安装mysql.5.5.30文.pdf
centos6.3中编译安装mysql.5.5.30[参照].pdf
本文档介绍了在CentOS6.3编译安装mysql源码包的祥细步骤,带各种命令参数的说明,附带可能出现错误的解决方法。
主要是针对配置centos6.3版本的安装、python26的安装、python26模块的安装、nginx服务的安装、hg安装、解决乱码问题及ftp问题,centos6.3版本的安装与配置,安装过程中的配置,安装包选择
CentOS 6.3 安装VMTools 本篇为大家介绍如何在CentOS 6.3中安装VMTools
CentOS6.3 64bit下MySQL安装步骤,该处使用的是tar包的方式,没有使用yum的方式是因为,yum相对简单,该方法适合数据库版本确定的情况下安装,文档中相信说明的安装的步骤,从文件下载,到安装,环境变量配置,解决...
Centos 6.3最小化安装桌面脚本 在最小化系统安装桌面
Centos6.3 yum安装lamp架构
CentOS6.3 Linux操作系统图文安装教程
几天时间在安装数据库时,遇到了诸多问题,这里整理一下,问题基本解决,
详细介绍了个人在虚拟机上安装的centos6.3系统下安装最新版本MYSQL数据库的过程和相关问题的解决。
Oracle 11gR2 For Centos6.3数据库安装文档 Oracle 11gR2 For Centos6.3数据库安装文档
centOS-6.3安装Mysql集群,Mysql集群易于搭建,基于内存运行,不需要共享存储,非常方便