参考:http://blog.chinaunix.net/u/29134/showart_485759.html可以说本文关键就是他mysql max 版本下载.或者你这 心情好 编译边参考 : ./configure --prefix=/home/lky/tools/mysql2 --with-plugins=heap,innobase,myisam,ndbcluster,federated,blackhole --enable-assembler --enable-static然后 在 my.cnf 的[mysqld]federated #加入mysql 参考:http://blog.chinaunix.net/u3/90603/showart_1925406.html
mysql>show engines;+------------+----------+----------------------------------------------------------------+--------------+-----+------------+|Engine|Support|Comment|Transactions|XA|Savepoints|+------------+----------+----------------------------------------------------------------+--------------+-----+------------+|ndbcluster|DISABLED|Clustered, fault-tolerant, memory-based tables|YES|NO|NO||FEDERATED|YES|Federated MySQL storage engine|YES|NO|NO||MRG_MYISAM|YES|Collectionofidentical MyISAM tables|NO|NO|NO||MyISAM|DEFAULT|DefaultengineasofMySQL3.23withgreat performance|NO|NO|NO||BLACKHOLE|YES|/dev/nullstorage engine (anything you writetoit disappears)|NO|NO|NO||InnoDB|YES|Supports transactions, row-levellocking,andforeignkeys|YES|YES|YES||MEMORY|YES|Hash based, storedinmemory, usefulfortemporarytables|NO|NO|NO||ARCHIVE|YES|Archive storage engine|NO|NO|NO|+------------+----------+----------------------------------------------------------------+--------------+-----+------------+
http://topic.csdn.net/u/20071122/11/016C3D25-82A2-46DC-B8B0-3A22F8573C70.html测试:0. mysql_install_db 生成 测试 basedir1. mysqld_safe 服务器开启2. mysql 测试先郁闷句 在max 版本上 没有 mysql_install_db !!,自己想办法把 ,下个其他版本的 给 install database !
[client]socket=/home/lky/data/d2/mysql.sock
port=3308[mysqld]port=3308datadir=/home/lky/data/d2
socket=/home/lky/data/d2/mysql.sock
user=lky
# Default to using old password format for compatibility with mysql3.x
# clients (those using the mysqlclient10 compatibility package).
#old_passwords=123[mysqld_safe]log-error=/home/lky/data/d2/mysqld.log
pid-file=/home/lky/data/d2/mysqld.pid
命令启动 服务1 # 注意 my.cnf 的端口 和datadircd /usr/local/mysql-max-5.1.5-alpha-linux-i686-glibc23update user set host="%" where user='root' ;./bin/mysqld_safe --defaults-file=/home/lky/data/d1/my.cnf启动 服务2 # 注意 my.cnf 的端口 和datadircd /usr/local/mysql-max-5.1.5-alpha-linux-i686-glibc23./bin/mysqld_safe --defaults-file=/home/lky/data/d2/my.cnf运行1./bin/mysql --defaults-file=/home/lky/data/d1/my.cnf>create table t_tableC (id int not null auto_increment primary key, c_str char(20) not null)>insert into t_tableC values(1,'cc');运行2./bin/mysql --defaults-file=/home/lky/data/d2/my.cnf>create table t_tableC (id int not null auto_increment primary key, c_str char(20) not null)engine federatedconnection = 'mysql://lky@127.0.0.1:3307/test/t_tableC';> select * from t_tableC ;+----+-------+| id | c_str |+----+-------+| 1 | cc |+----+-------+最让我喜欢的一个特性:在 d2 上 (运行2)上本地的 表 可以和 federated 进行 表连
mysql>select*fromt2 ;+------+------+|id|vn|+------+------+|1|cc|+------+------+1rowinset(0.29sec)
mysql>showcreatetablet2 ;+-------+----------------------------------------------------------------------------------------------------------------------+|Table|CreateTable|+-------+----------------------------------------------------------------------------------------------------------------------+|t2|CREATETABLE`t2` (
`id`int(11)defaultNULL,
`vn`char(10)defaultNULL) ENGINE=MyISAMDEFAULTCHARSET=latin1|+-------+----------------------------------------------------------------------------------------------------------------------+1rowinset(0.00sec)
mysql>select*fromt_tableC c,t2 twherec.id=c.id ;+----+--------+------+------+|id|c_str|id|vn|+----+--------+------+------+|1|cc|1|cc||2|ccttcc|1|cc|+----+--------+------+------+2rowsinset(0.00sec)
本文转自博客园刘凯毅的博客,原文链接:mysql federated 表类型使用,如需转载请自行联系原博主。
本文介绍了MySQL Federated存储引擎的安装配置与使用方法,并通过示例展示了如何在不同实例间建立连接,实现跨服务器的数据查询。
556

被折叠的 条评论
为什么被折叠?



